What are connected and local routes, and why does IOS show an L route for every interface?
Show the answer
Say this first
A connected route (C) is the subnet of an interface that has an IP address and is up/up. Since IOS 15 the router also shows a local route (L), a /32 for its own address on that interface. The L route makes the router's own addresses visible in the routing table. In CEF they are receive entries: packets to them are punted to the CPU instead of being forwarded.
Go deeper
Example
C 10.0.12.0/30 is directly connected, GigabitEthernet0/0/1
L 10.0.12.1/32 is directly connected, GigabitEthernet0/0/1The router owns 10.0.12.1. Anything else in 10.0.12.0/30 is reached by ARP on Gi0/0/1.
When they appear and disappear
- Both need an IP address and line protocol up. Shut the interface, or lose the link, and both are removed at once, along with every static route that depended on that interface.
- Secondary addresses get their own C and L entries.
- Connected routes have AD 0, so no protocol can override them for the same prefix.
Redistribution
redistribute connected takes the C routes. The L /32s are not redistributed. If you want a router's
loopback in another protocol, it is the connected subnet of the loopback that gets advertised.
Other platforms
Junos shows the same pair as Direct (the subnet) and Local (the /32). Linux puts local addresses in the
separate local table (ip route show table local).
They will ask next
An interface is up/down. Is its subnet in the routing table?
No. Connected routes need line protocol up. That is why a static route pointing out that interface also disappears, which is exactly the behaviour you want for failover on a link that really goes down.
Traps
- Thinking L routes are learned from somewhere. They are generated from the router's own addresses.