Configure Static Host Routes

Host Routes

This topic shows you how to configure an IPv4 and IPv6 static host route and when to use them.

A host route is an IPv4 address with a 32-bit mask, or an IPv6 address with a 128-bit mask. The following shows the three ways a host route can be added to the routing table:

  • Automatically installed when an IP address is configured on the router (as shown in the figures)
  • Configured as a static host route
  • Host route automatically obtained through other methods (discussed in later courses)

Automatically Installed Host Routes

Cisco IOS automatically installs a host route, also known as a local host route, when an interface address is configured on the router. A host route allows for a more efficient process for packets that are directed to the router itself, rather than for packet forwarding. This is in addition to the connected route, designated with a C in the routing table for the network address of the interface.

When an active interface on a router is configured with an IP address, a local host route is automatically added to the routing table. The local routes are marked with L in the output of the routing table.

For example, refer to the topology in the figure.

The IP addresses assigned to the Branch Serial0/1/0 interface are 198.51.100.1/30 and 2001:db8:acad:1::1/64. The local routes for the interface are installed by the IOS in the IPv4 and IPv6 routing tables, as shown in the example.

Branch# show ip route | begin Gateway
Gateway of last resort is not set
      198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks
C        198.51.100.0/30 is directly connected, Serial0/1/0
L        198.51.100.1/32 is directly connected, Serial0/1/0
Branch# show ipv6 route | begin :: 
C   2001:DB8:ACAD:1::/64 [0/0]
     via Serial0/1/0, directly connected
L   2001:DB8:ACAD:1::1/128 [0/0]
     via Serial0/1/0, receive
L   FF00::/8 [0/0]
     via Null0, receive

Static Host Routes

A host route can be a manually configured static route to direct traffic to a specific destination device, such as the server shown in the figure. The static route uses a destination IP address and a 255.255.255.255 (/32) mask for IPv4 host routes, and a /128 prefix length for IPv6 host routes.

15.5.4

Configure Static Host Routes

The example shows the IPv4 and IPv6 static host route configuration on the Branch router to access the server.

Branch(config)# ip route 209.165.200.238 255.255.255.255 198.51.100.2
Branch(config)# ipv6 route 2001:db8:acad:2::238/128 2001:db8:acad:1::2
Branch(config)# exit
Branch#

Verify Static Host Routes

A review of both the IPv4 and IPv6 route tables verifies that the routes are active.

Branch# show ip route | begin Gateway
Gateway of last resort is not set
      198.51.100.0/24 is variably subnetted, 2 subnets, 2 masks
C        198.51.100.0/30 is directly connected, Serial0/1/0
L        198.51.100.1/32 is directly connected, Serial0/1/0
      209.165.200.0/32 is subnetted, 1 subnets
S        209.165.200.238 [1/0] via 198.51.100.2
Branch# show ipv6 route
(Output omitted)
C   2001:DB8:ACAD:1::/64 [0/0]
     via Serial0/1/0, directly connected
L   2001:DB8:ACAD:1::1/128 [0/0]
     via Serial0/1/0, receive
S   2001:DB8:ACAD:2::238/128 [1/0]
     via 2001:DB8:ACAD:1::2
Branch#

Configure IPv6 Static Host Route with Link-Local Next-Hop

For IPv6 static routes, the next-hop address can be the link-local address of the adjacent router. However, you must specify an interface type and an interface number when using a link-local address as the next hop, as shown in the example. First, the original IPv6 static host route is removed, then a fully specified route configured with the IPv6 address of the server and the IPv6 link-local address of the ISP router.

Branch(config)# no ipv6 route 2001:db8:acad:2::238/128 2001:db8:acad:1::2
Branch(config)# ipv6 route 2001:db8:acad:2::238/128 serial 0/1/0 fe80::2
Branch# show ipv6 route | begin ::
C   2001:DB8:ACAD:1::/64 [0/0]
     via Serial0/1/0, directly connected
L   2001:DB8:ACAD:1::1/128 [0/0]
     via Serial0/1/0, receive
S   2001:DB8:ACAD:2::238/128 [1/0]
     via FE80::2, Serial0/1/0
Branch#

 

Module Practice and Quiz