cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2952
Views
5
Helpful
19
Replies

IP routing question

Ahmed Malik
Level 1
Level 1

Hi,

    i am attaching an image regarding ip routing. can anyone tell me the exact answer for this as i am preparing for the ccna exam so here it is and do explain the answer to me as well.

Regards,

routing.JPG

6 Accepted Solutions

Accepted Solutions

Hi,

when a router must forward a packet it looks in its routing table for the route having the longest match, that is which has the most common bits with the destination adress.If it has multiple longest matches then it looks if these are learnt from the same protocol and if so it will choose the route with the lowest metric( cost), if these come from different protocols then it will choose the one with the lower AD( connected(0)< static(1)< eBGP(20)

external EIGRP(170)

Regards.

Alain

Don't forget to rate helpful posts.

View solution in original post

John,

Allow me please to elaborate on something you wrote.

1. Choose the route with the longest prefix match.

2. If you routes happen to have the same longest prefix match, then look at the Administrative Distance

3. The router will choose the route with the lowest Administrative Distance and lowest Metric.

4. If you have multiple routes with the same lowest Administrative Distance and lowest metric,
   then the router will load balance.

You are confusing the process of building a routing table with the process of using (or searching) the routing table.

With respect to building a routing table, the steps 2-4 apply. However, when searching in a routing table, only the Step 1 applies (with an amendment that if multiple paths are found, the router will load balance).

It is in my opinion important to differentiate between these two processes, as they basically correspond to control and data plane of a router.

Best regards,

Peter

View solution in original post

John

Peter is quite correct. In your post you suggest that

But what if there was another entry in the routing table, such as "O   192.168.32.0/26 [110/25789217] via 10.1.1.5" .

But in that case as the router was building the routing table it would find that the new O route with admin distance 110 was worse than the existing D route with admin distance 90 and would NOT put the O route into the routing table.

To repeat Peters point with slightly different phrasing - consideration of factors such as admin distance or metric are used in building the routing table. When forwarding a packet the router searches the routing table and its only criteria is longest match (neither admin distance or metric are considered when searching the routing table to forward data traffic).

HTH

Rick

HTH

Rick

View solution in original post

John

It is not quite true that running multiple routing protocols on the local router will produce multiple entries for a route. There are a couple of ways that you might get multiple entries for a route in the IP routing table.

- you might have several entries for a route (perhaps for example 172.16.1.0) if there were entries with different prefix lengths. for example you might have these entries

172.16.1.0 255.255.255.0

172.16.1.0 255.255.255.192

172.168.1.0 255.255.255.248

- you might have several entries for a route with the same prefix length if the same routing protocol found several different equal cost paths to the same prefix. So you might have entries like this

172.16.1.0 255.255.255.0 next-hop 192.168.1.1

172.16.1.0 255.255.255.0 next-hop 192.168.2.1

172.168.1.0 255.255.255.0 next-hop 192.168.3.1

Note that if the same protocol finds several equal cost paths then there will be multiple entries but if different protocols find paths to the same prefix then building the routing table will select only one of them to be inserted into the IP routing table.

HTH

Rick

HTH

Rick

View solution in original post

Florian,

Do not look at the IP addresses of the next hop routers when searching for the longest prefix match. Look at the addresses of the networks themselves. For the packet destined to 10.1.5.65, the longest matching entry is the network 10.1.5.64/29, as this network matches the destination in its first 29 bits, or in other words,

/29 = 255.255.255.248

10.1.5.65 AND 255.255.255.248 = 10.1.5.64

ANDing the destination IP address with the mask /29 yields the result 10.1.5.64 which matches the network 10.1.5.64/29, with the next hop 10.1.3.3. No other routing entry in the routing table gives you such a long match (or a match at all), so this one is the best.

Best regards,

Peter

View solution in original post

joeadiutori
Level 1
Level 1

For the network 10.1.5.0/24, there are 256 nodes.

For the network 10.1.5.64/29, there are 8 nodes.

The address in question is 10.1.5.65, and it falls into both networks above.  Since the /29 network is the smallest network, Cisco views this as the most precise network option, and will therefore forward the packet to the /29 network.  The answer is C.

View solution in original post

19 Replies 19

vipinrajrc
Level 3
Level 3

Hi,

It should be 10.1.3.3. Because router take the higest CIDR value route first.

Hope this helps

Thanks

Vipin

Thanks and Regards, Vipin

can u explain a but more? i mean can u elaborate your answer.

Thanks

Hi,

It is the default nature of IOS. it will take only the highet CIDR value first.

For example if you have a static route and a RIP route to same destination but with different CIDR value.

Lets assume for static route 192.168.1.0/24 and for RIP 192.168.1.0/24. Router will consider the RIP route for the destination to 192.168.1.1, even if RIP administrative distance is 90 and static route's is 1.

This is all i know.

if anybody is having more idea than this, please share..

Thanks

Vipin

Thanks and Regards, Vipin

vipin raj wrote:

Hi,

It is the default nature of IOS. it will take only the highet CIDR value first.

For example if you have a static route and a RIP route to same destination but with different CIDR value.

Lets assume for static route 192.168.1.0/24 and for RIP 192.168.1.0/24. Router will consider the RIP route for the destination to 192.168.1.1, even if RIP administrative distance is 90 and static route's is 1.

This is all i know.

if anybody is having more idea than this, please share..

Thanks

Vipin

The point you said above is correct. But the example you provided has got the same CIDR values(/24)

Krishna

oops!! sorry.. my mistake

static route 192.168.1.0/24 and for RIP 192.168.1.0/25

Thanks and Regards, Vipin

Hi,

when a router must forward a packet it looks in its routing table for the route having the longest match, that is which has the most common bits with the destination adress.If it has multiple longest matches then it looks if these are learnt from the same protocol and if so it will choose the route with the lowest metric( cost), if these come from different protocols then it will choose the one with the lower AD( connected(0)< static(1)< eBGP(20)

external EIGRP(170)

Regards.

Alain

Don't forget to rate helpful posts.

1. Choose the route with the longest prefix match.

2. If you routes happen to have the same longest prefix match, then look at the Administrative Distance

3. The router will choose the route with the lowest Administrative Distance and lowest Metric.

4. If you have multiple routes with the same lowest Administrative Distance and lowest metric,
   then the router will load balance.

For Example:

You are looking for a route to destination 10.1.1.4

Routing Table
-------------
10.0.0.0/8 [1/0] via a.a.a.a
10.1.0.0/16 [120/4] via b.b.b.b
10.1.1.0/24 [110/64] via c.c.c.c
10.1.1.4/32 [110/64] via d.d.d.d
10.1.1.4/32 [110/64] via e.e.e.e

The router will look at the routing table, and discover that the longest match to destination
IP address if 10.1.1.4/32. Then the router will say, Hey!, I have multiple routes with the
same longest match, I'm not going to look at the Administrative Distance, the router will see
that route 10.1.1.4/32 via d.d.d.d and 10.1.1.4/32 via e.e.e.e have the same administrative
distance and lowest metric. The router will then load balance traffic to 10.1.1.4 via d.d.d.d
and e.e.e.e

I could go a little further, but that should give you a general idea.\

I hope that helps!

John,

Allow me please to elaborate on something you wrote.

1. Choose the route with the longest prefix match.

2. If you routes happen to have the same longest prefix match, then look at the Administrative Distance

3. The router will choose the route with the lowest Administrative Distance and lowest Metric.

4. If you have multiple routes with the same lowest Administrative Distance and lowest metric,
   then the router will load balance.

You are confusing the process of building a routing table with the process of using (or searching) the routing table.

With respect to building a routing table, the steps 2-4 apply. However, when searching in a routing table, only the Step 1 applies (with an amendment that if multiple paths are found, the router will load balance).

It is in my opinion important to differentiate between these two processes, as they basically correspond to control and data plane of a router.

Best regards,

Peter

What if you have the following.

router# show ip route

     ....

     D   192.168.32.0/26 [90/25789217] via 10.1.1.1

     R   192.168.32.0/24 [120/4] via 10.1.1.2

     O   192.168.32.0/19 [110/229840] via 10.1.1.3

     ....

The routing table has already been built.

So Step 1 would apply and find that the longest match is /26 which has a next hop of 10.1.1.1. But what if there was another entry in the routing table, such as "O   192.168.32.0/26 [110/25789217] via 10.1.1.5" . The router would then go to Step 2 and look at the administrative distance, the router would see that 90 has the lowest administrative distance and choose that route.

You're confusing me a little bit about the following statement.

You are confusing the process of building a routing table with the process of using (or searching) the routing table.

If you have multiple routing protocols running, for instance, EIGRP and OSPF, you're still going to have both routes listed on the same router (depending on route-redistribution or if they are both running on the same router).

John

Peter is quite correct. In your post you suggest that

But what if there was another entry in the routing table, such as "O   192.168.32.0/26 [110/25789217] via 10.1.1.5" .

But in that case as the router was building the routing table it would find that the new O route with admin distance 110 was worse than the existing D route with admin distance 90 and would NOT put the O route into the routing table.

To repeat Peters point with slightly different phrasing - consideration of factors such as admin distance or metric are used in building the routing table. When forwarding a packet the router searches the routing table and its only criteria is longest match (neither admin distance or metric are considered when searching the routing table to forward data traffic).

HTH

Rick

HTH

Rick

I gotcha Richard...

*bow* to Peter.

I'm still a little confused. I understand what you mean by Control Plane and Data Plane, but how is it then, you see multiple routes

from different routing protocols in a routing table, I'm assuming the only way this is possible, is if you are running multiple routing

protocols on the local router?

John

It is not quite true that running multiple routing protocols on the local router will produce multiple entries for a route. There are a couple of ways that you might get multiple entries for a route in the IP routing table.

- you might have several entries for a route (perhaps for example 172.16.1.0) if there were entries with different prefix lengths. for example you might have these entries

172.16.1.0 255.255.255.0

172.16.1.0 255.255.255.192

172.168.1.0 255.255.255.248

- you might have several entries for a route with the same prefix length if the same routing protocol found several different equal cost paths to the same prefix. So you might have entries like this

172.16.1.0 255.255.255.0 next-hop 192.168.1.1

172.16.1.0 255.255.255.0 next-hop 192.168.2.1

172.168.1.0 255.255.255.0 next-hop 192.168.3.1

Note that if the same protocol finds several equal cost paths then there will be multiple entries but if different protocols find paths to the same prefix then building the routing table will select only one of them to be inserted into the IP routing table.

HTH

Rick

HTH

Rick

I gotcha.

flokki123
Level 3
Level 3

hi guys,

just read your posts and dont understand the CIDR thing. i mean i know that the router takes the longest matching route from the routing table for the routing process, but why is the correct answer to the above question 10.1.3.3? i thought it would be 10.1.4.4, as this is the route with has the most bits in common with the ip address. why is it the address with the /25 mask?

regards,

florian

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: