cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
64232
Views
23
Helpful
3
Comments
Luc De Ghein
Cisco Employee
Cisco Employee

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.

Comments
jturello
Level 1
Level 1

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!

aion00031
Community Member

Hello,

You can configure static route on for your /32 address:

ip route 10.10.10.10 255.255.255.255 Null0

then you can redistribute that static into the bgp, so it will be advertised to neighbors as /32 route, when the packet arrives at router's interface, that static route not working because of AD =1, while you have same local route (= connected with AD 0). 

Eugen Serban
Level 1
Level 1

Hello,

I'm also trying to redistribute that /32 route without success. I had the same idea as you: creating a static to null0 and then redistribute static in bgp, but it does not work.

It redistributes all my other static routes, but not that one.

If someone has an idea, please share!

Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking for a $25 gift card