dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
13373
JDmailNY
join:2007-12-02
Pearl River, NY

JDmailNY

Member

[CCNA] How to calculate the next hop

I'm having major problems understanding hop count and how to calculate the next hop.

Can someone give me some examples or refer me to a site

Thanks
meta
join:2004-12-27
00000

4 edits

meta

Member

The best next hop determination depends on the routing protocol used to select it.
More than one routing protocol can be running on a router at the same time (each with their own best next hops).
Once every running routing protocol decides their own next hops (they dont have to agree) each routing protocol installs one (or more) routes in the routing table.
The routing table takes the best hop with the lowest administrative distance for the most specific destination.

Overly complex and funny example:

A router is running several routing protocols and is directly connected to many other routers 1.1.1.[1-9].

On a given router RIP is running (because im assuming since you are talking about hop count, you are studying RIP)
RIP has 3 neighbors, 1.1.1.1, 1.1.1.2, and 1.1.1.3.
Each neighbor sends routes for the network 192.168.0.0/24.
1.1.1.1 has that network at 1 hop away
1.1.1.2 has that network at 2 hops away
1.1.1.3 has that network at 3 hops away
RIP decides the best next hop to 192.168.0.0/24 is 1.1.1.1 so it installs 1.1.1.1 in the routing table.

DBM (me) also hates rip, so he runs bgp and peers with his route-reflector. BGP reports the best path to 192.168.0.0/24 via 1.1.1.4. BGP decides its next best hop is 1.1.1.4 and installs that in the routing table.

HELLFIRE (who likes to troll my posts) is lazy, and doesnt want to run a routing protocol so he added a static route to the router for 192.168.0.0/16 pointing to his router 1.1.1.5.
His static route is installed into the routing table.

The routing table now looks like this:
(Static) 192.168.0.0/16 -> 1.1.1.5
(iBGP) 192.168.0.0/24 -> 1.1.1.4
(RIP) 192.168.0.0/24 -> 1.1.1.1

If a packet comes into the router destined for 192.168.0.1, which next hop would be used?

First criteria to decide: prefix length. The longer prefixes /24 are more specific than the summary HELLFIRE put into the router, so we will only consider those 2 routes (rip and ibgp)

The second criteria, is administrative distance. Admin distance is how trustworthy the routing protocol is. In this case, RIP with an AD of 120, and iBGP is 200.

Becuase RIP has the most specific prefix for the destination, and the lowest administrative distance of the equal-length prefixes, the router will forward the packet to 1.1.1.1.

I hope the example is helpful, and somewhat demeaning to hellfire =P

! We can see that the router hears about 192.168.0.0 from many rip neighbors
R1# debug ip rip
*Feb 27 13:27:52.979: RIP: received v2 update from 1.1.1.3 on Serial1/3
*Feb 27 13:27:52.983:      192.168.0.0/24 via 0.0.0.0 in 3 hops
*Feb 27 13:27:55.583: RIP: received v2 update from 1.1.1.1 on Serial1/1
*Feb 27 13:27:55.583:      192.168.0.0/24 via 0.0.0.0 in 1 hops
*Feb 27 13:28:00.895: RIP: received v2 update from 1.1.1.2 on Serial1/2
*Feb 27 13:28:00.895:      192.168.0.0/24 via 0.0.0.0 in 2 hops
...
 
! But rip will only install the lowest hop count in its database.
R1#show ip rip database 192.168.0.0 255.255.255.0
192.168.0.0/24
    [1] via 1.1.1.1, 00:00:01, Serial1/1
 
! RIP installs only its best route in the routing table.
! BGP and static routes also show up because other protocols added them.
R1#show ip route | I 192.168.0.0
S     192.168.0.0/16 [1/0] via 1.1.1.5, Serial1/5
R     192.168.0.0/24 [120/1] via 1.1.1.1, 00:00:00, Serial1/1
B     192.168.0.0/24 [200/0] via 1.1.1.4, 00:00:00, Serial1/4
 
! Less specific packets will goto HELLFIREs router
R1#show ip route 192.168.1.0 
Routing entry for 192.168.0.0/16, supernet
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 1.1.1.5, via Serial1/5
      Route metric is 0, traffic share count is 1
 
! But the most specific route will go via RIP.
R1#show ip route 192.168.0.0
Routing entry for 192.168.0.0/24
  Known via "rip", distance 120, metric 3
  Redistributing via rip
  Last update from 1.1.1.1 on Serial1/1, 00:00:10 ago
  Routing Descriptor Blocks:
  * 1.1.1.1, from 1.1.1.1, 00:00:10 ago, via Serial1/1
      Route metric is 1, traffic share count is 1
 
 
*actual output may be fudged for effect. I had distribute-lists slapped everywhere to force the advertisments to show up (split horizon, other loop prevention and path muckery)
JDmailNY
join:2007-12-02
Pearl River, NY

JDmailNY

Member

This is good information thanks
meta
join:2004-12-27
00000

meta

Member

I know right? I wish somebody had warned me HELLFIRE was a troll when i was taking cisco classes =P

(why am i so mean today? lol)

tubbynet
reminds me of the danse russe
MVM
join:2008-01-16
Gilbert, AZ

tubbynet

MVM

said by meta:

I know right? I wish somebody had warned me HELLFIRE was a troll when i was taking cisco classes =P
not mean - snarky.
just sounds so much cooler.

i also feel slightly offended that i wasn't in the example as the classic bullsh!tter - maybe something with is-is.

q.

belushi
Premium Member
join:2000-11-08
Twinsburg, OH

belushi to JDmailNY

Premium Member

to JDmailNY
Even before the routing protocol is examined to calculate next hop as mentioned earlier, it is the longest prefix match in the routing table. That is the first thing looked at.
meta
join:2004-12-27
00000

meta to tubbynet

Member

to tubbynet
lol tubby i forgot to include you, so sorry. ill try harder in the future =P Somehow hellfire was on my mind thismorning.
HELLFIRE
MVM
join:2009-11-25

HELLFIRE to JDmailNY

MVM

to JDmailNY
This for the CCNA part for routing protocols, JDmailDY? Refer to the
infamous 5-router ring example for hop-count:

»www.simulationexams.com/ ··· a-r1.gif

As the top link has one hop, it's considered the preferred route when
using a Distance Vector protocol like RIP or IGRP over the bottom link
which has two hops, the reason being the fewer the hops, the more preferred
the route it is.

If you ran EIGRP, OSPF or IS-IS in this same scenario which are link-state
protocols and use bandwidth in their calculation of route metrics, then
the traffic would take the bottom route due to the higher bandwidth ('cost')
of the path.

@deepblackmag
S'all in good fun, and I found it a wonderful refresher course on routing myself....
And now I'm going to get some rest from running around your mind all day =P =P

FYI, I'm just a regular guy who does this for a living, and while other people
geek out to cars or hockey in their off-hours spare time, I geek out to Cisco,
so I hang around here

Regards