Guest

IP Routing

Local Host Routes Installed in the Routing Table on Cisco IOS and Cisco IOS-XR

Document ID: 116264

Updated: Jul 10, 2013

Contributed by Luc De Ghein and Pete Lumbis, Cisco TAC Engineers.

   Print

Introduction

This document describes the situation where Cisco IOS® and Cisco IOS-XR install "local" host routes in the routing table for both IPv6 and IPv4. IPv6 Local Routes have always existed. IPv4 Local Routes were added with the introduction of the Multi-Topology Routing (MTR) feature.

Prerequisites

Requirements

There are no specific requirements for this document.

Components Used

The information in this document is based on Cisco IOS Version 15.0(1)S and Cisco IOS-XR Version 4.3.1.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

Cisco IOS Local Routes

Local routes are marked with an "L" in the output from the show ip route command.

Here is an interface with one IPv4 and one IPv6 address:

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

The IP addresses assigned to Ethernet0/0 are 10.1.1.1/30 for IPv4 and 2001:db8::1/64 for IPv6. Neither are host routes. A host route for IPv4 has the mask /32, and a host route for IPv6 has the mask /128.

For each IPv4 and IPv6 address, Cisco IOS installs 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

C        10.1.1.0/30 is directly connected, Ethernet0/0
L        10.1.1.1/32 is directly connected, Ethernet0/0

In the previous routing table, 10.1.1.1/32 is 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:DB8::/64 [0/0]
      via Ethernet0/0, directly connected
L   2001:DB8::1/128 [0/0]
      via Ethernet0/0, receive
L   FF00::/8 [0/0]
      via Null0, receive

In the previous routing table, 2001:db8::1/128 is 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: The local routes have the administrative distance of 0. This is the same adminstrative distance as connected routes. However, when you configure redistributed connected under any routing process, the connected routes are redistributed, but the local routes are not. This behavior allows the networks to not require a large number of host routes, because the networks of the interfaces are advertised with their proper masks. These host routes are only needed on the router that owns the IP address in order to process packets destined to that IP address.

In Cisco IOS, you can also use the show ipv6 route local command in order to display only the local IPv6 routes.

Here is an example in Cisco 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:DB8::1/128 [0/0]
     via Ethernet0/0, receive
L   FF00::/8 [0/0]
     via Null0, receive

Here are some Cisco Express Forwarding (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:db8::1/128
2001:DB8::1/128
   receive for Ethernet0/0

Because the local host routes are in the routing table, these local host routes also exist in the CEF table. Since these IP addresses are configured on this router (they are local), these CEF entries are receive entries. Therefore, when the router sees packets with a destination IP address that matches these CEF entries, the packets are punted in order to be processed by the router itself.

Manually Configured Host Routes

If an IPv4 address is configured with a mask of /32 on an interface of the router, which is typical for loopback interfaces, the host route appears 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, which is typical for loopback interfaces, the host route appears with both the L and C flags.

 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:DB8:1111::1/128 [0/0]
      via Loopback0, receive

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

Cisco IOS-XR Local Routes

In Cisco IOS-XR, either the show route local or the show route ipv6 local command is used in order to view the local host routes.

 
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, the host routes appears with the L flag. They are known through local, but installed as connected routes. Hence, these routes are redistributed when redistribute connected is configured under the routing protocol.

Here is an example:

 RP/0/RP0/CPU0:router#show route 10.10.10.1/32

Routing entry for 10.10.10.1/32
   Known via "local", distance 0, metric 0 (connected)
   Installed Jul 10 10:50:30.265 for 00:20:07
   Routing Descriptor Blocks
     directly connected, via Loopback0
       Route metric is 0
   No advertising protos.

RP/0/RP0/CPU0:router#show route ipv6 2001:db8:2222::1/128

Routing entry for 2001:db8:2222::1/128
  Known via "local", distance 0, metric 0 (connected)
  Installed Jul 10 10:53:05.745 for 00:16:51
  Routing Descriptor Blocks
    directly connected, via Loopback0
      Route metric is 0
  No advertising protos.

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

Multi-Topology Routing

The local entries are needed by the MTR feature. In MTR, 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 the router that owns the IP address, even if that topology is not enabled on that interface. This is why local host routes are present in all topologies, even if the topology is disabled.

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

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

Routing Table: red

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

Routing Table: blue

L        10.1.1.1 is directly connected, Ethernet0/0


The routing table of topology red has the connected /30 route and the local /32 route. Topology blue is not enabled on Ethernet0/0. Although the routing table of topology blue does not have the connected /30 route, it does have the local /32 route.

Conclusion

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

Updated: Jul 10, 2013
Document ID: 116264