fbpx
Configure Static Host Routes
Configure Static Host Routes

Configure Static Host Routes

Configure Static Host Routes
5

Summary

This topic configure IPv4 and IPv6 static host routes that direct traffic to a specific host. Start learning CCNA 200-301 for free right now!!

Note: Welcome: This topic is part of Module 15 of the Cisco CCNA 2 course, for a better follow up of the course you can go to the CCNA 2 section to guide you through an order.

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.

Static Host Routes
Static Host Routes

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.

Static Host Routes
Static Host Routes

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#

Syntax Checker – Configure Static Host Routes

Configure and verify static host routes based on the specified requirements

Static Host Routes
Static Host Routes

Display the routing tables on the Branch router.

  • Issue the command to view the IPv4 routing table.
  • Issue the command to view the IPv6 routing table.
Branch#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, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
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
IPv6 Routing Table - default - 3 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, R - RIP, H - NHRP, I1 - ISIS L1
       I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
       EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination
       NDr - Redirect, RL - RPL, O - OSPF Intra, OI - OSPF Inter
       OE1 - OSPF ext 1, OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1
       ON2 - OSPF NSSA ext 2, a - Application
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
  • Enter Global Configuration mode to configure the following:
  • A static IPv4 route to a host at address 209.165.200.238 and an exit interface of s0/1/0.
  • A static IPv6 route to a host at address 2001:db8:acad::2 and an exit interface of s0/1/0.

Note: Be sure to use s0/1/0 as the interface designation.

Branch#configure terminal
Branch(config)#ip route 209.165.200.238 255.255.255.255 s0/1/0
Branch(config)#ipv6 route 2001:db8:acad:2::238 s0/1/0
  • Exit configuration mode and display the IPv4 and IPv6 routing tables.
Branch(config)#exit
\*Sep 19 19:06:47.301: %SYS-5-CONFIG\_I: Configured from console by console
Branch#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, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
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 is directly connected, Serial0/1/0
Branch#show ipv6 route
IPv6 Routing Table - default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, R - RIP, H - NHRP, I1 - ISIS L1
       I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
       EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination
       NDr - Redirect, RL - RPL, O - OSPF Intra, OI - OSPF Inter
       OE1 - OSPF ext 1, OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1
       ON2 - OSPF NSSA ext 2, a - Application
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 Serial0/1/0, directly connected
L   FF00::/8 \[0/0\]
     via Null0, receive

You have successfully configured static host routes.

Glossary: If you have doubts about any special term, you can consult this computer network dictionary.

Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.

Full Network BundleCourse Offer