Local Host Routes in the Routing Table

Document

May 2, 2011 6:09 AM
May 2nd, 2011

Local Host Routes

In IOS and IOS-XR we have "local" host routes in the routing table. Let's have a look what they are and why we see them.

Local routes are marked with "L" in the output of "show ip route".


These local routes exist in the routing table for IPv6 since day one. The addition of IPv4 local routes was made later on. The addition was made with the introduction of the feature Multi Topology Routing (MTR) in IOS. This is why it is likely that you notice these local routes now, because having IPv4 routes in the routing table as local routes is more recent.

This is one interface with one IPv4 and one IPv6 address on it.

interface Ethernet0/0
  ip address 10.1.1.1 255.255.255.252
  ipv6 address 2001::1/64

The IP addresses assigned to Ethernet0/0 are 10.1.1.1/30 for IPv4 and 2001::1/64 for IPv6.

Neither are host routes. A host route for IPv4 has the mask /32 and for IPv6 it is the mask /128. For each IPv4 and IPv6 address, IOS will install host routes in the respective routing tables.


R1#show 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
        + - replicated route, % - next hop override


Gateway of last resort is not set


       10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C        10.1.1.0/30 is directly connected, Ethernet0/0
L        10.1.1.1/32 is directly connected, Ethernet0/0

We see that 10.1.1.1/32 is in the routing table as a local host route.

R1#show ipv6 route
IPv6 Routing Table - default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
        B - BGP, R - RIP, I1 - ISIS L1, I2 - ISIS L2
        IA - ISIS interarea, IS - ISIS summary, D - EIGRP, EX - EIGRP external
        ND - Neighbor Discovery
        O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
        ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
C   2001::/64 [0/0]
      via Ethernet0/0, directly connected
L   2001::1/128 [0/0]
      via Ethernet0/0, receive
L   FF00::/8 [0/0]
      via Null0, receive

We see that 2001::1/128 is in the routing table as a local host route.

(The FF00::/8 route is also a local route, but this route is needed for multicast routing and hence is not covered in this document.)

Note that the local routes have the administrative distance of 0.  This is the same adminstrative distance as connected routes. However,  when configuring "redistributed connected" under any routing process,  the connected routes are redistributed, but the local routes are not.  This is to protect the network from having a large amount of host  routes, which are not needed, since the networks of the interfaces are  advertised with their proper masks. These host routes are really only  needed on the router owning the IP address in order to process packets  destined to that IP address.

In IOS, you can also use "show ipv6 route local" in order to display only the local IPv6 routes. In IOS-XR, you can use "show route local" or  "show route ipv6 local".

example in IOS:

R1#show ipv6 route local
IPv6 Routing Table - default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
        B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
        I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
        D - EIGRP, EX - EIGRP external, NM - NEMO, ND - Neighbor Discovery
L   2001::1/128 [0/0]
      via Ethernet0/0, receive
L   FF00::/8 [0/0]
      via Null0, receive

CEF entries:

R1#show ip cef 10.1.1.1/32
10.1.1.1/32
   receive for Ethernet0/0


R1#show ipv6 cef 2001::1/128
2001::1/128
   receive for Ethernet0/0

As a result of having the local host routes in the routing table, we'll also see these local host routes in the CEF table. Since these IP addresses are configured on this router (they are local), these CEF entries will be "receive" entries so that when the router sees packets with a destination IP address matching these CEF entries, the packets will be punted to be processed by the router itself.

For IOS:
If an IPv4 address is configured with a mask of /32 on an interface of the router (typical for loopback interfaces), then the host route will appear in the routing table only as connected (it has the C flag).

R1#show ip route | include 10.100.1.1
C        10.100.1.1/32 is directly connected, Loopback0


R1#show ip route 10.100.1.1
  Routing entry for 10.100.1.1/32
    Known via "connected", distance 0, metric 0 (connected, via interface)
    Routing Descriptor Blocks:
    * directly connected, via Loopback0
        Route metric is 0, traffic share count is 1


If an IPv6 address is configured with a mask of /128 on an interface of the router (typical for loopback interfaces), then the host route will appear with both the L and C flag.

R1#show ipv6 route                
IPv6 Routing Table - default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
        B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
        I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
        D - EIGRP, EX - EIGRP external, NM - NEMO, ND - Neighbor Discovery


LC  2001:1111::1/128 [0/0]
      via Loopback0, receive

These routes are redistributed when "redistribute connected" is configured under the routing protocol.


For IOS-XR:
If an IPv4 address is configured on an interface of the router with a mask of /32 or an IPv6 address is configured with a mask of /128, then the host routes will appear with the L flag. They are known via "local", but installed as connected routes and hence are redistributed when "redistribute connected" is configured under the routing protocol.

exmaple:

RP/0/RP0/CPU0:router#show route 23.23.23.23


Routing entry for 23.23.23.23/32
  
Known via "local", distance 0, metric 0 (connected)
   Installed May  2 14:50:28.450 for 00:02:21
   Routing Descriptor Blocks
     directly connected, via Loopback22
       Route metric is 0
   No advertising protos.


The result is that the router can always install a CEF entry for the configured IP address by only looking for the corresponding entry in the routing table. This also prevents a misconfiguration where a route with longer mask than the connected entry would be learned from another router. Hence, traffic destined for the local IP address could then be misdirected to a remote router.

Multi Topology Routing (MTR)

Finally, the local entries are needed by the feature MTR. In MTR we can have multiple topologies. One interface/IP address can belong to multiple topologies. If one topology is not enabled on one interface in MTR, that connected route is not present in that topology. However, the packets destined to that IP address must still be processed by that router owning the IP address, even if that toplogy is not enabled on that interface. That's why those local host routes are present in all topologies, even if the topology is disabled.

In this example, we enabled topology red on interface Ethernet 0/0, but not topology blue.

global-address-family ipv4
  topology blue
  !
  topology red
  !
  
interface Ethernet0/0
  ip address 10.1.1.1 255.255.255.252
  ipv6 address 2001::1/64
  !
  topology ipv4 unicast red
  !


R1#show ip route topology red


Routing Table: red


       10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C        10.1.1.0/30 is directly connected, Ethernet0/0
L        10.1.1.1/32 is directly connected, Ethernet0/0


R1#show ip route topology blue


       10.0.0.0/32 is subnetted, 2 subnets
L        10.1.1.1 is directly connected, Ethernet0/0


We see that the routing table of topology red has the connected /30 route and the local /32 route. Topology blue is not enabled on Ethernet0/0, but while the routing table of topology blue does not have the connected /30 route, it does have the local /32 route.

Conclusion

Having local host routes in the IPv4 and IPv6 routing table for IP addresses of the router's interfaces, is normal. Their purpose is to create a corresponding CEF entry, which is a receive entry, so that the packets destined to this IP address can be procesed by the router itself. These routes cannot be redistributed into any routing protocol.

Average Rating: 4.5 (4 ratings)

Comments

jturello@u-link.fr Mon, 11/04/2013 - 09:55

Hello,

Is there any way or "trick" to redistribute these local /32 addresses via a routing protocol? I tried with BGP, because one of our peers requires a /32 route, but I could'nt make it worked..

Thanks!

Actions

Login or Register to take actions

This Document

Posted May 2, 2011 at 6:09 AM
Stats:
Comments:1 Avg. Rating:4.5
Views:12445 Contributors:1
Shares:0
Tags: routing, rib
+

Related Content

Documents Leaderboard