02-07-2012 12:41 AM - edited 03-10-2019 12:17 PM
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 192.168.1.1/24
PC2 have been configured with loopback ip address 192.168.1.1/32
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 192.168.1.1" 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 ?
Thanks...
Solved! Go to Solution.
05-06-2012 09:51 PM
Hi
The rule is -> AD, THEN the prefixe lenghts.
The link have been given to you in my response ( 7th April )
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml
02-07-2012 01:18 AM
Hi,
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.
Regards.
Alain
02-07-2012 01:41 AM
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 192.168.1.1/24
ip route 192.168.1.1 255.255.255.255 192.168.1.2 (this next hop is reachable)
so why when i issue sh ip route 192.168.1.1, i see "know via connected", not static cause of shorter netmask lenght.
sorry im still dont understand..
02-07-2012 02:00 AM
Hi,
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 192.168.1.1/24
ip route 192.168.1.1 255.255.255.255 192.168.1.2
Regards.
Alain.
02-07-2012 02:09 AM
Kajatonas88,
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 192.168.1.1 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 192.168.2.1/32, 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.
--Lessaid
Best regards,
02-07-2012 02:20 AM
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 192.168.1.1/24 and 192.168.1.1/32, 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...
02-07-2012 02:36 AM
Ho ok, then your lab is wrong.
This should work when you have let's say
(R1)------(R2)-----(R3)
EIGRP between R2 and R1/R3, 100Meg link.
R1 have 192.168.1.1/32 loopback
R3 have 192.168.1.1/24 loopback
Then on R2, if you type show ip route 192.168.1.1, 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.
--Lessaid
Best regards,
02-07-2012 03:37 AM
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
172.16.0.0/30 is subnetted, 1 subnets
D 172.16.1.0 [90/307200] via 10.1.1.1, 00:05:37, FastEthernet0/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Loopback1
R5#sh ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(192.168.1.1)
P 10.1.1.0/30, 1 successors, FD is 281600
via Connected, FastEthernet0/0
P 192.168.1.1/32, 0 successors, FD is Inaccessible
via 10.1.1.1 (435200/409600), FastEthernet0/0
P 192.168.1.0/24, 1 successors, FD is 128256
via Connected, Loopback1
P 172.16.1.0/30, 1 successors, FD is 307200
via 10.1.1.1 (307200/281600), FastEthernet0/0
the 192.168.1.1/32 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.
02-07-2012 04:02 AM
Because the router already know that the 192.168.1.0/24 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.
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml
05-05-2012 02:38 PM
still confused
another example :
i have router with loopback configured:
interface Loopback1
ip address 192.168.1.1 255.255.255.0
end
and some static routes:
ip route 192.168.1.1 255.255.255.255 Null0
ip route 192.168.1.2 255.255.255.255 Null0
ip route 192.168.1.9 255.255.255.255 9.9.9.8
and the routing table is:
R1#sh ip route
Gateway of last resort is not set
9.0.0.0/24 is subnetted, 1 subnets
C 9.9.9.0 is directly connected, Loopback9
192.168.1.0/24 is variably subnetted, 3 subnets, 2 masks
S 192.168.1.9/32 [1/0] via 9.9.9.8
C 192.168.1.0/24 is directly connected, Loopback1
S 192.168.1.2/32 is directly connected, Null0
why routing table dont install this static route (ip route 192.168.1.1 255.255.255.255 Null0) even this address is directly connected on loopback interface ? The directly connected interface generates a prefix with
192.168.1.0/24 subnet mask, which is larger than static route 192.168.1.1/32 prefix.
05-05-2012 03:30 PM
Hi
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
05-06-2012 01:59 AM
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."..
05-06-2012 07:40 AM
First thing for selection between 2 routes of different prefixes if Administrative distance.
In your example,
interface Loopback1
ip address 192.168.1.1 255.255.255.0 AD=0 (Connected route)
ip route 192.168.1.1 255.255.255.255 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 192.168.1.1 255.255.255.252.0 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.
HTH
Mohsin
05-06-2012 01:12 PM
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...
05-06-2012 09:51 PM
Hi
The rule is -> AD, THEN the prefixe lenghts.
The link have been given to you in my response ( 7th April )
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide