Installing routes on route table.

Answered Question
Feb 7th, 2012
User Badges:

Hello, i have an easy question regarding installing routes.

Imagine if i have two PC's with loopbacks.

PC1 have been configured with loopback ip address

PC2 have been configured with loopback ip address

routing between them is for example is made with EIGRP, no auto summary. (or static routing whatever)

Why when i issue the command on PC1 "show ip route" i see the connected /24 loopback. Why i not see the EIGRP learned /32 route from PC2 ? I should've forgot something basic, i remember that it should select routes by the longest match ? whats means i should see /32 from PC2 ?


Correct Answer by lessaid.a about 5 years 2 months ago


The rule is -> AD, THEN the prefixe lenghts.

The link have been given to you in my response ( 7th April )

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (4 ratings)
cadet alain Tue, 02/07/2012 - 01:18
User Badges:
  • Purple, 4500 points or more


the longest match logic is used by the router to choose a route in the routing table to forward the packet to the destination IP not for insertion of the route in the RIB( this is done looking at the metric or if the routes were learned from different sources looking at the AD BUT this logic is for equal length prefixes).

Now if the route from the distant subnet was not installed in the RIB it may be in case of EIGRP because you've got no neighbour relationship or because you have a filter in place but we need your configs as well as the topology to see why it wasn't installed.



kajatonas88 Tue, 02/07/2012 - 01:41
User Badges:

thanks for reply!

But there is no filters, the EIGRP neighbor relationship is ok, also i tried with RIP routing protocol, also with static routing.

Also for clearer example.

on R1:

I have loopback

ip route (this next hop is reachable)

so why when i issue sh ip route, i see "know via connected", not static cause of shorter netmask lenght.

sorry im still dont understand..

cadet alain Tue, 02/07/2012 - 02:00
User Badges:
  • Purple, 4500 points or more


because the AD of connected route is zero which is best than the AD of a static route which is 1.

you shouldn't configure a static route for a destination that is already connected to your router as it doesn't need one as it knows this is directly connected:

I have loopback

ip route



lessaid.a Tue, 02/07/2012 - 02:09
User Badges:


Just want to know the point of your lab. Because you use the same address ip but with a /32 and a /24 mask.

Both of then will never leave the router as the is installed on the RIB as already known on the router.

Using a /24 for a loopback is only for kind of announcing a virtual network on your network. You cannot mix it with the same ip with another mask

Try to use a different third octet like, this should work like a charm.

And remember that the administrative distance of a connected interface is 0, the static route is 1, so even you add static routes, when the battle came to choose between connected and static, the connected will always work.


Best regards,

kajatonas88 Tue, 02/07/2012 - 02:20
User Badges:

my point of this lab is just for knowledge..

As i know first the router checks for subnet lenght, if it TIES, only then the Administrative distance come to play...

GUYS!!! I know that this subnet overlaps.

The QUESTION still exists

Why when we have and, the /24 subnet wins even with the SHORTER subnet mask.

The route selection algorythm says that the route with the longest prefix length should win...

lessaid.a Tue, 02/07/2012 - 02:36
User Badges:

Ho ok, then your lab is wrong.

This should work when you have let's say


EIGRP between R2 and R1/R3, 100Meg link.

R1 have loopback

R3 have loopback

Then on R2, if you type show ip route, this will lead to R1.You can try it with a ping and debug ip icmp

You can try with different routing like ospf from R1/R2 and EIGRP between R2/R3, you will see both routes but ping will always do on the R1.


Best regards,

kajatonas88 Tue, 02/07/2012 - 03:37
User Badges:

ye it works perfectly for example from R1 or R2 perspective, but the same Question exist on R3. when i issue "show ip route" on R3.

R5#sh ip route is subnetted, 1 subnets

D [90/307200] via, 00:05:37, FastEthernet0/0 is subnetted, 1 subnets

C is directly connected, FastEthernet0/0

C is directly connected, Loopback1

R5#sh ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(

P, 1 successors, FD is 281600
        via Connected, FastEthernet0/0
P, 0 successors, FD is Inaccessible
        via (435200/409600), FastEthernet0/0
P, 1 successors, FD is 128256
        via Connected, Loopback1
P, 1 successors, FD is 307200
        via (307200/281600), FastEthernet0/0

the is known, but for some reasons(inaccessible) not installed in EIGRP. But this behavior not dependant on which protocol i use...

The main question exists... i understand that this is BAd design, but WHY the most specified route is not installing in route table, can someone explain me in educational language.

lessaid.a Tue, 02/07/2012 - 04:02
User Badges:

Because the router already know that the is connected behind the loopback0, He will not install it, even if it see it coming from an EIGRP route update.

Trying to understand some routing concept based on a Bad design will not help you to understand the behavior of the routing decision.

To answer to your question :

The most specified route is not installing on the routing table because it's already in.

First battle : Administrative distance 0 (/24) vs 90 (/32)

(/24) win and no change on the RIB

In case of a Tie of the first battle, then the prefix length battle will be starting !

Here the doc that you could check that could help you out.

kajatonas88 Sat, 05/05/2012 - 14:38
User Badges:

still confused

another example :

i have router with loopback configured:

interface Loopback1

ip address


and some static routes:

ip route Null0

ip route Null0

ip route

and the routing table is:

R1#sh ip route

Gateway of last resort is not set is subnetted, 1 subnets

C is directly connected, Loopback9 is variably subnetted, 3 subnets, 2 masks

S [1/0] via

C is directly connected, Loopback1

S is directly connected, Null0

why routing table dont install this static route (ip route Null0) even this address is directly connected on loopback interface ? The directly connected interface generates a prefix with subnet mask, which is larger than static route prefix.

lessaid.a Sat, 05/05/2012 - 15:30
User Badges:


The router compare routes and select the most specifique router When and only When the came from the same routing protocol.

In you exemple this is not your case. You have to understand that your route from the loopback have a administrative distance of 0 ( connected ) so your router will select this route over the static route ( with an asministrative distance of 1 ) even

if it's more specifique

So to install routes on the RIB, the router do compare :

Same Administrative distance ?

   yes -> most specifique route will be installed on the RIB

   No -> lower administrative distance route will be installed on the RIB

Hope this help

kajatonas88 Sun, 05/06/2012 - 01:59
User Badges:

but cisco documentation says "it depends on the prefix length, or the number of  bits set in the subnet mask. Longer prefixes are always preferred over  shorter ones when forwarding a packet."..

mohsin-raza Sun, 05/06/2012 - 07:40
User Badges:

First thing for selection between 2 routes of different prefixes if Administrative distance.

In your example,

interface Loopback1

ip address                                         AD=0 (Connected route)

ip route Null0                                  AD=1 (Static Route)

You CANNOT assign the same ip with difference prefix in the same AD command (i.e. router will not allow to add another loopback2 with ip address lets say), reason is simple, Same AD..

Once the Admin Distance is decided, then comes the Metric (each routing protocol uses different Metric, metric is used in static routes for floating statics) Again, same IP with difference prefix cannot be with same metric on a router.

Once the decision is made through AD and Metric, Prefix lenght rule is applied on the same routes.



kajatonas88 Sun, 05/06/2012 - 13:12
User Badges:

thanks for trying to answer me, but my dumb head just dont working at this point

ok, i understand that this is BAD design and this NOT working and CAN'T work. But still dont understand WHY !? if the prefix lenghts are different - then it should match the longest prefix, and if the prefix lenght is the same - then check the AD. Where i can read the rules of installing routes into RIB ? i want to find this in official CISCO document...


This Discussion