ā03-16-2016 01:07 AM - edited ā03-08-2019 04:59 AM
hello all,
when creating a static route the next hop can be identified by an IP address, exit interface, or both. depending on which one is used a following route type will be created:
Now in an exercise they as me to :
Step 1: Configure recursive static routes on R1.
a. What is recursive static route?
b. Why does a recursive static route require two routing table lookups?
c. Configure a recursive static route to every network not directly connected to R1, including the WAN link between R2 and R3.
d. Test connectivity to the R2 LAN and ping the IP addresses of PC2 and PC3.
I know what is a recursive lookup - it will require more than one lookup before forwarding the packet. So if i create a static route pointing to the next-hop IP it will require another lookup to resolve the egress interface to send the packet, for example 172.16.1.1 via 192.168.1.1 >> 192.168.1.1 is directly connected, FastEthernet0/1 BUT according to CISCO Cisco Express Forwarding is eliminating recursive lookup because it maintains al information it needs in the FIB and adjacency table (so only one lookup is performed!). So why the hell they even bother me to configure it ?
Looking forward to get to clarification !
Best Regards
Adam
ā03-16-2016 01:40 AM
Hello Adam,
Well CEF resolves the recursive next hop pro-actively but the RIB and the CAM tables trickle down to the FIB and the adjacency table but this resolution or computation requires the involvement of the CPU and the IOS processes.
If you have a lot of recursive lookups then that may cause an unstable environment due to frequent route changes etc. leading to high CPu or resource exhaustion; and in certain cases it is also good to have recursive routes.
Say as an example you have 200 static routes pointing through a specific next-hop say the next-hop changes so instead of changing those 200 routes you could have used a single next hop associated with all the 200 routes and then have this next hop recursively resolved.
Now if the next-hop changes you just need to change one IP route and that would automatically change all the other routes from a forwarding perspective.
Here is an example of the config and the CEF outputs for your reference--
R1(config)#do sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 [1/0] via 172.16.1.1
172.16.0.0/32 is subnetted, 1 subnets
S 172.16.1.1 [1/0] via 192.168.1.2
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Ethernet0/0
L 192.168.1.1/32 is directly connected, Ethernet0/0
R1(config)#do sh ip cef
Prefix Next Hop Interface
0.0.0.0/0 no route
0.0.0.0/8 drop
0.0.0.0/32 receive
1.1.1.1/32 192.168.1.2 Ethernet0/0
127.0.0.0/8 drop
172.16.1.1/32 192.168.1.2 Ethernet0/0
192.168.1.0/24 attached Ethernet0/0
192.168.1.0/32 receive Ethernet0/0
192.168.1.1/32 receive Ethernet0/0
192.168.1.2/32 attached Ethernet0/0
192.168.1.255/32 receive Ethernet0/0
224.0.0.0/4 drop
224.0.0.0/24 receive
240.0.0.0/4 drop
255.255.255.255/32 receive
R1(config)#do sh run | in ip route
ip route 1.1.1.1 255.255.255.255 172.16.1.1
ip route 172.16.1.1 255.255.255.255 192.168.1.2
R1(config)#do sh ip cef 1.1.1.1 detail
1.1.1.1/32, epoch 0
recursive via 172.16.1.1
recursive via 192.168.1.2
attached to Ethernet0/0
I hope this helps.
Thanks,
Shaunak
ā03-16-2016 02:05 AM
Shaunak,
but wouldn't i have to first disable CEF prior to be able to use recursive routing ?
thank you and best regards
Adam
ā03-16-2016 02:11 AM
Adam,
No, CEF will not hinder the routers ability to do recursive routing or need not be disabled for that. In fact disabling CEF can cause additional overhead on the CPU to forward the traffic as chances are that the data will be process switched and may cause high CPU.
CEF is a proprietary forwarding mechanism and this is built by the information from the RIB and the CAM table once built it is not refreshed until there is a change in the RIB or the CAM table.
Thanks,
Shaunak
ā03-16-2016 02:37 AM
Shaunak,
would you call this a recursive static route ?
Adam
ā03-16-2016 02:42 AM
Assuming that the config is done on R1 this will not be termed as a recursive route.
A recursive route will be when the next hop of route 1 is then recursively resolved by the next hop of route 2. Hence it will look like this, route to destination x goes through next hop a and next hop a is resolved through next hop b hence this will be a recursive route since there is recursion in resolving the next hop when we need to forward data to dest x.
to go to x go to next hop a but next hop a is not directly connected and needs to be recursively resolved by b. you may refer the static route config that I posted earlier.
Thanks,
Shaunak
ā03-16-2016 02:46 AM
Would this be an example of recursive route:
10.1.1.1 via 172.16.1.1 >>172.16.1.1 via 192.168.1.1 >> 192.168.1.1 is directly connected, FastEthernet0/1.
but not this one:
172.16.1.1 via 192.168.1.1 >> 192.168.1.1 is directly connected, FastEthernet0/1.
correct ?
ā03-16-2016 02:53 AM
Adam,
Yes, exactly this would be recursive routing. Although to look at the specifics even a route with a next hop IP mentioned undergoes a certain degree of recursion since the router needs to identify the interface the next hop is reachable on. That's why it is recommended to mention the full route with the next hop IP and the exit interface to even save on that lookup.
But, as far as recursion is concerned your example is correct.
Thanks,
Shaunak
ā03-16-2016 03:36 AM
Hmm, yes so that's why I was asking it the example above is a recursive static route. In my case (without CEF) it would perform 2 lookups to send the packet out to the 10.0.0.0 network.
But according to netacad materials from cisco:
"A recursive static route is valid (that is, it is a candidate for insertion in the routing table) only when the specified next hop resolves, either directly or indirectly, to a valid exit interface."
so wouldn't that mean that the above ase (gns3 lab) is also a type of recursive query ?
ā03-16-2016 05:06 AM
ā03-16-2016 05:57 AM
Adam,
A valid point, a recursive route is valid if and only if the next-hop is valid that means the next hop is can be resolved. Say the router is not able to ping the next hop due to an ARP issue but still the route will be valid since the interface associated with it is in the up/up state.
Like I said when you mention only the next hop IP then there is a certain degree of lookup to check the exit interface but a recursive route in it's true sense is termed as a route which is dependent on another configured route or a dynamically installed route to resolve the next hop and forward packets.
The amount of lookups and how the data is forwarded depends on the forwarding process as well, whether it's process switched or fast switched or CEF switched. The switching method depends on the forwarding methods configured on the ingress and egress interfaces of the router.
Thanks,
Shaunak
ā03-16-2016 08:50 AM
but is a recursive static route the same as a next-hop route?
ā03-16-2016 09:58 AM
Yes, that's correct static routes can be of different kinds, you have a route with the next hop IP this can either be a directly connected neighbour or this next hop can be recursively resolved.
It's not how you configure the static route but how the next hop gateway/IP is resolved that determines whether it's a recursive static route or not.
A route with an attached interface mentioned will again execute the ARP process every time a packet to a new destination is forwarded (only in multi access environments like Ethernet) on serial point to point links this is fairly simple. So depending upon the media and the config forwarding of data can vary I mean the steps followed to get the packets across can be different.
Even a default route can be classified under the umbrella of static routes. So a recursive route will have a next-hop IP which is resolved by another next hop IP in other words.
Thanks,
Shaunak
ā03-16-2016 10:17 AM
I understand what they mean now.
When you enter a static route with just a next hop IP the routing table does not record the interface used to get to that next hop IP and I suspect this is what they are referring to.
Although it is not something that has ever occurred to me before I guess technically a second lookup is required to find the directly connected entry which does record the interface or at least I assume that is what happens.
So it could be considered recursive even though that is not what I normally think of as recursive.
Obviously using CEF means the above does not apply in terms of number of lookups.
Jon
ā03-16-2016 10:17 AM
Hi Jon,
Yes, that's correct there is a recursion to find out the interface associated with the next hop this happens even with CEF enabled but it happens only once, since CEF programs the forwarding information base pro-actively and this kind of recursion is not really detrimental to the device.
Whereas if you see the next hop IP to next hop IP recursion that will have another recursion to find out the interface associated with the final next hop IP as well, this will be a recursive route and the more levels of recursion you have the less calable it will be.
Thanks,
Shaunak
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