Routing - what is recursive routing
Recursive routing takes place when multiple router lookups are necessary to determine the exit interface of an outgoing packet from a router. For example, refer to the following topology:
R3 has a loopback interface that we want to reach from R1. Static routing will be configured in R1 so that this destination is reachable. The static routes configured in R1 are the following:
R1(config)#ip route 184.108.40.206 255.255.255.0 192.168.23.3 R1(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2
The first static route is used to reach the L0 interface of R3 and has a next hop address of 192.168.23.3, which is the** FastEthernet0/0 interface of R3**. Notice the next hop address of this entry is** not on a directly connected network**.
The second static route is required to be able to reach that next hop address of 192.168.23.3. Examine the routing table of R1:
R1#show ip route Codes: 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, per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, FastEthernet0/0 220.127.116.11/24 is subnetted, 1 subnets S 18.104.22.168 [1/0] via 192.168.23.3 S 192.168.23.0/24 [1/0] via 192.168.12.2
Whenever R1 wants to reach 22.214.171.124/24, three lookups must take place:
- The first lookup is to check the entry for 126.96.36.199 /24. It’s there and the next hop IP address is 192.168.23.3
- The second lookup is to determine how to get to that next hop IP of 192.168.23.3. There’s an entry there and the next hop IP address is 192.168.12.2.
- The third and last lookup is for 192.168.12.2. There’s an entry and it is directly connected.
Note the following:
- The last lookup in a recursive lookup scenario is always a lookup that results in an exit interface.
- Any entry with a next hop IP address will always require a recursive lookup to determine the exit interface.
- The only entry that does not require a recursive lookup is one with an explicitly defined exit interface. For example:
ip route 188.8.131.52 255.255.255.0 fastethernet 0/0