As previously stated, static routes are widely used in networks today. Static routes are used in networks of all sizes, and are used along with a dynamic routing protocol. For this reason, a good understanding of static routes is a requirement for implementing routing on a network. Show
Reach Remote Networks (2.1.1.1)A router can learn about remote networks in one of two ways:
Figure 2-1 provides a sample scenario of static routing. Figure 2-2 provides a sample scenario of dynamic routing using EIGRP.
Figure 2-1 Static and Default Route Scenario
Figure 2-2 Dynamic Routing Scenario A network administrator can manually configure a static route to reach a specific network. Unlike a dynamic routing protocol, static routes are not automatically updated and must be manually reconfigured any time the network topology changes. A static route does not change until the administrator manually reconfigures it. Why Use Static Routing? (2.1.1.2)Static routing provides some advantages over dynamic routing, including:
Static routing has the following disadvantages:
In Table 2-1, dynamic and static routing features are compared. Notice that the advantages of one method are the disadvantages of the other. Table 2-1 Dynamic Routing Versus Static Routing
Static routes are useful for smaller networks with only one path to an outside network. They also provide security in a larger network for certain types of traffic or links to other networks that need more control. It is important to understand that static and dynamic routing are not mutually exclusive. Rather, most networks use a combination of dynamic routing protocols and static routes. This may result in the router having multiple paths to a destination network via static routes and dynamically learned routes. However, the administrative distance (AD) of a static route is 1. Therefore, a static route will take precedence over all dynamically learned routes. When to Use Static Routes (2.1.1.3)Static routing has three primary uses:
Figure 2-3 shows an example of a stub network connection and a default route connection. Notice in the figure that any network attached to R1 would only have one way to reach other destinations, whether to networks attached to R2, or to destinations beyond R2. This means that network 172.16.3.0 is a stub network and R1 is a stub router. Running a routing protocol between R2 and R1 is a waste of resources.
Figure 2-3 Stub Networks and Stub Routers In this example, a static route can be configured on R2 to reach the R1 LAN. Additionally, because R1 has only one way to send out non-local traffic, a default static route can be configured on R1 to point to R2 as the next hop for all other networks. Static Route Applications (2.1.2.1)Static routes are most often used to connect to a specific network or to provide a Gateway of Last Resort for a stub network. They can also be used to:
The following types of IPv4 and IPv6 static routes will be discussed:
Standard Static Route (2.1.2.2)Both IPv4 and IPv6 support the configuration of static routes. Static routes are useful when connecting to a specific remote network. Figure 2-4 shows that R2 can be configured with a static route to reach the stub network 172.16.3.0/24.
Figure 2-4 Connecting to a Stub Network Default Static Route (2.1.2.3)A default static route is a route that matches all packets. A default route identifies the gateway IP address to which the router sends all IP packets that it does not have a learned or static route for. A default static route is simply a static route with 0.0.0.0/0 as the destination IPv4 address. Configuring a default static route creates a Gateway of Last Resort. Default static routes are used:
Refer to Figure 2-5 for a sample scenario of implementing default static routing.
Figure 2-5 Connecting to a Stub Router Summary Static Route (2.1.2.4)To reduce the number of routing table entries, multiple static routes can be summarized into a single summary static route if:
In Figure 2-6, R1 would require four separate static routes to reach the 172.20.0.0/16 to 172.23.0.0/16 networks. Instead, one summary static route can be configured and still provide connectivity to those networks.
Figure 2-6 Using One Summary Static Route Floating Static Route (2.1.2.5)Another type of static route is a floating static route. Floating static routes are static routes that are used to provide a backup path to a primary static or dynamic route, in the event of a link failure. The floating static route is only used when the primary route is not available. To accomplish this, the floating static route is configured with a higher administrative distance than the primary route. Recall that the administrative distance represents the trustworthiness of a route. If multiple paths to the destination exist, the router will choose the path with the lowest administrative distance. For example, assume that an administrator wants to create a floating static route as a backup to an EIGRP-learned route. The floating static route must be configured with a higher administrative distance than EIGRP. EIGRP has an administrative distance of 90. If the floating static route is configured with an administrative distance of 95, the dynamic route learned through EIGRP is preferred to the floating static route. If the EIGRP-learned route is lost, the floating static route is used in its place. In Figure 2-7, the Branch router typically forwards all traffic to the HQ router over the private WAN link. In this example, the routers exchange route information using EIGRP. A floating static route, with an administrative distance of 91 or higher, could be configured to serve as a backup route. If the private WAN link fails and the EIGRP route disappears from the routing table, the router selects the floating static route as the best path to reach the HQ LAN.
Figure 2-7 Configuring a Backup Route Page 2
Summary static routes can be used to help minimize the number of static routes in the routing table. Using summary static routes can also make management of a large number of static routes easier and less prone to errors. Floating static routes can be used as a backup route for another static route or a dynamic routing protocol. Configure IPv4 Summary Routes (2.4.1)A single IPv4 static summary route can be used to replace multiple static routes when those routes can be summarized with a common prefix length. The configuration of a summary static route is similar to the configuration of other IPv4 static routes. Route Summarization (2.4.1.1)Route summarization, also known as route aggregation, is the process of advertising a contiguous set of addresses as a single address with a less-specific, shorter subnet mask. CIDR is a form of route summarization and is synonymous with the term supernetting. CIDR ignores the limitation of classful boundaries, and allows summarization with masks that are smaller than that of the default classful mask. This type of summarization helps reduce the number of entries in routing updates and lowers the number of entries in local routing tables. It also helps reduce bandwidth utilization for routing updates and results in faster routing table lookups. In Figure 2-52, R1 requires a summary static route to reach networks in the range of 172.20.0.0/16 to 172.23.0.0/16.
Figure 2-52 Basic Topology Calculate a Summary Route (2.4.1.2)Summarizing networks into a single address and mask can be done in three steps, as shown in Figure 2-53:
Figure 2-53 Calculating a Route Summary Figure 2-54 displays R1 configured with a summary static route to reach networks 172.20.0.0/16 to 172.23.0.0/16.
Figure 2-54 One Summary Static Route Summary Static Route Example (2.4.1.3)Multiple static routes can be summarized into a single static route if:
Consider the example in Figure 2-55. All routers have connectivity using static routes.
Figure 2-55 Basic Topology The following output displays the static routing table entries for R3. Notice that it has three static routes that can be summarized because they share the same two first octets. R3# show ip route static | begin Gateway Gateway of last resort is not set 172.16.0.0/24 is subnetted, 3 subnets S 172.16.1.0 is directly connected, Serial0/0/1 S 172.16.2.0 is directly connected, Serial0/0/1 S 172.16.3.0 is directly connected, Serial0/0/1 R3#Figure 2-56 displays the steps to summarize those three networks:
After the summary route is identified, replace the existing routes with the one summary route.
Figure 2-56 Summarize the Networks The following output shows how the three existing routes are removed and then the new summary static route is configured: R3(config)# no ip route 172.16.1.0 255.255.255.0 s0/0/1 R3(config)# no ip route 172.16.2.0 255.255.255.0 s0/0/1 R3(config)# no ip route 172.16.3.0 255.255.255.0 s0/0/1 R3(config)# ip route 172.16.0.0 255.255.252.0 s0/0/1 R3(config)#The following output confirms that the summary static route is in the routing table of R3: R3# show ip route static | begin Gateway Gateway of last resort is not set 172.16.0.0/22 is subnetted, 1 subnets S 172.16.0.0 is directly connected, Serial0/0/1 R3#Configure IPv6 Summary Routes (2.4.1)Similar to IPv4, a single IPv6 static summary route can be used to replace multiple IPv6 static routes with a common prefix length. The calculation and configuration of an IPv6 summary static route is similar to the configuration of an IPv4 static summary route. Summarize IPv6 Network Addresses (2.4.2.1)Aside from the fact that IPv6 addresses are 128 bits long and written in hexadecimal, summarizing IPv6 addresses is actually similar to the summarization of IPv4 addresses. It just requires a few extra steps due to the abbreviated IPv6 addresses and hex conversion. Multiple static IPv6 routes can be summarized into a single static IPv6 route if:
Refer to the network in Figure 2-57. R1 currently has four static IPv6 routes to reach networks 2001:DB8:ACAD:1::/64 to 2001:DB8:ACAD:4::/64.
Figure 2-57 Basic Topology The following output displays the IPv6 static routes installed in the IPv6 routing table: R1# show ipv6 route static IPv6 Routing Table - default - 7 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 - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 S 2001:DB8:ACAD:1::/64 [1/0] via 2001:DB8:FEED:1::2 S 2001:DB8:ACAD:2::/64 [1/0] via 2001:DB8:FEED:1::2 S 2001:DB8:ACAD:3::/64 [1/0] via 2001:DB8:FEED:1::2 S 2001:DB8:ACAD:4::/64 [1/0] via 2001:DB8:FEED:1::2 R1#Calculate IPv6 Network Addresses (2.4.2.2)Summarizing IPv6 networks into a single IPv6 prefix and prefix length can be done in seven steps as shown in Figures 2-58 to 2-64:
Figure 2-58 Identify the Part Where the Addresses Differ
Figure 2-59 Identify the Part Where the Addresses Differ – Expanded View
Figure 2-60 Convert the Section from Hex to Binary
Figure 2-61 Count the Number of Far Left Matching Bits
Figure 2-62 Add Zero Bits to Determine the Summarized Network Address
Figure 2-63 Convert the Binary Section Back to Hex
Figure 2-64 Count the Number of Far Left Matching Bits Configure an IPv6 Summary Address (2.4.2.3)After the summary route is identified, replace the existing routes with the single summary route. Figure 2-65 displays how the four existing routes are removed and then the new summary static IPv6 route is configured.
Figure 2-65 Remove Static Routes and Configure Summary IPv6 Route The following output confirms that the summary static route is in the routing table of R1: R1# show ipv6 route static IPv6 Routing Table - default - 4 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 - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 S 2001:DB8:ACA8::/45 [1/0] via 2001:DB8:FEED:1::2 R1#Configure Floating Static Routes (2.4.3)There may be times when a primary route fails due to physical layer problems, hardware issues, a misconfiguration, or many other reasons. A floating static route can be used as a backup route when there is a secondary path available. Floating Static Routes (2.4.3.1)Floating static routes are static routes that have an administrative distance greater than the administrative distance of another static route or dynamic routes. They are very useful when providing a backup to a primary link, as shown in Figure 2-66.
Figure 2-66 Why Configure a Floating Static Route? By default, static routes have an administrative distance of 1, making them preferable to routes learned from dynamic routing protocols. For example, the administrative distances of some common dynamic routing protocols are:
The administrative distance of a static route can be increased to make the route less desirable than that of another static route or a route learned through a dynamic routing protocol. In this way, the static route “floats” and is not used when the route with the better administrative distance is active. However, if the preferred route is lost, the floating static route can take over, and traffic can be sent through this alternate route. A floating static route can be used to provide a backup route to multiple interfaces or networks on a router. It is also encapsulation independent, meaning it can be used to forward packets out any interface, regardless of encapsulation type. An important consideration of a floating static route is that it is affected by convergence time. A route that is continuously dropping and re-establishing a connection can cause the backup interface to be activated unnecessarily. Configure a Floating Static Route (2.4.3.2)IPv4 static routes are configured using the ip route global configuration command and specifying an administrative distance. If no administrative distance is configured, the default value (1) is used. Refer to the topology in Figure 2-67. In this scenario, the preferred route from R1 is to R2. The connection to R3 should be used for backup only.
Figure 2-67 Configure a Floating Static Route to R3 R1 is configured with a default static route pointing to R2. Because no administrative distance is configured, the default value (1) is used for this static route. R1 is also configured with a floating static default pointing to R3 with an administrative distance of 5. This value is greater than the default value of 1 and, therefore, this route floats and is not present in the routing table, unless the preferred route fails. The following output verifies that the default route to R2 is installed in the routing table. Note that the backup route to R3 is not present in the routing table. R1# show ip route static | begin Gateway Gateway of last resort is 0.0.0.0 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 172.16.2.2 R1#Test the Floating Static Route (2.4.3.3)Because the default static route on R1 to R2 has an administrative distance of 1, traffic from R1 to R3 should go through R2. The output in Figure 2-68 confirms that traffic between R1 and R3 flows through R2.
Figure 2-68 Verify the Path to the R3 LAN What would happen if R2 failed? To simulate this failure, both serial interfaces of R2 are shut down, as shown in the following output: R2(config)# int s0/0/0 R2(config-if)# shut *Feb 21 16:33:35.939: %LINK-5-CHANGED: Interface Serial0/0/0, changed state to admin- istratively down *Feb 21 16:33:36.939: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to down R2(config-if)# int s0/0/1 R2(config-if)# shut R2(config-if)# *Feb 21 16:33:42.543: %LINK-5-CHANGED: Interface Serial0/0/1, changed state to admini- stratively down *Feb 21 16:33:43.543: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/1, changed state to downNotice in the following output that R1 automatically generates messages indicating that the serial interface to R2 is down. A look at the routing table verifies that the default route is now pointing to R3 using the floating static default route configured for next-hop 10.10.10.2. *Feb 21 16:35:58.435: %LINK-3-UPDOWN: Interface Serial0/0/0, changed state to down *Feb 21 16:35:59.435: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to down R1# R1# show ip route static | begin Gateway Gateway of last resort is 0.0.0.0 to network 0.0.0.0 S* 0.0.0.0/0 [5/0] via 10.10.10.2 R1#The output confirms that traffic now flows directly between R1 and R3: R1# traceroute 192.168.2.1 Type escape sequence to abort. Tracing the route to 192.168.2.1 VRF info: (vrf in name/id, vrf out name/id) 1 10.10.10.2 4 msec 4 msec * R1#Page 3
Now that you have learned how to configure different types of static routes, this section discusses how to troubleshoot some of the common problems you might encounter. Troubleshooting exercises are an excellent method to help better understand network protocols and configurations. When a static route is no longer needed, that static route should be deleted from the running and startup configuration files. Packet Processing with Static Routes (2.5.1)Now that you have configured static routes, you need to learn about the process that a packet goes through as it is forwarded by a router. Static Routes and Packet Forwarding (2.5.1.1)The following example describes the packet forwarding process with static routes. Examine Figure 2-69, where PC1 is sending a packet to PC3:
Troubleshoot IPv4 Static and Default Route Configuration (2.5.2)Troubleshooting is a skill that develops as you gain experience. It is always best to look for the most obvious and simplest issues first, such as an interface still in shutdown mode or an interface with the wrong IP address. After these items have been verified, begin looking for more complicated possibilities like an error in the static route configuration. Troubleshooting a Missing Route (2.5.2.1)When end-to-end connectivity is a problem, begin by making sure that you can ping your own interface and other devices on your own directly connected networks. When this has been verified, begin testing connectivity to remote networks from other devices. Networks are subject to forces that can cause their status to change quite often:
When there is a change in the network, connectivity may be lost. Network administrators are responsible for pinpointing and solving the problem. To find and solve these issues, a network administrator must be familiar with tools to help isolate routing problems quickly. Common IOS troubleshooting commands include:
Figure 2-70 displays the result of an extended ping from the source interface of R1 to the LAN interface of R3. An extended ping is when the source interface or source IP address is specified.
Figure 2-70 Extended Ping The following output displays the result of a traceroute from R1 to the R3 LAN: R1# traceroute 192.168.2.1 Type escape sequence to abort. Tracing the route to 192.168.2.1 VRF info: (vrf in name/id, vrf out name/id) 1 172.16.2.2 4 msec 4 msec 8 msec 2 192.168.1.1 12 msec 12 msec * R1#The following output displays the routing table of R1: R1# show ip route | begin Gateway Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks S 172.16.1.0/24 [1/0] via 172.16.2.2 C 172.16.2.0/24 is directly connected, Serial0/0/0 L 172.16.2.1/32 is directly connected, Serial0/0/0 C 172.16.3.0/24 is directly connected, GigabitEthernet0/0 L 172.16.3.1/32 is directly connected, GigabitEthernet0/0 S 192.168.1.0/24 [1/0] via 172.16.2.2 S 192.168.2.0/24 [1/0] via 172.16.2.2 R1#The following output provides a quick status of all interfaces on the router: R1# show ip interface brief Interface IP-Address OK? Method Status Protocol Embedded-Service-Engine0/0 unassigned YES unset administratively down down GigabitEthernet0/0 172.16.3.1 YES manual up up GigabitEthernet0/1 unassigned YES unset administratively down down Serial0/0/0 172.16.2.1 YES manual up up Serial0/0/1 unassigned YES unset administratively down down R1#The show cdp neighbors command in the following output provides a list of directly connected Cisco devices. This command validates Layer 2 (and therefore Layer 1) connectivity. For example, if a neighbor device is listed in the command output, but it cannot be pinged, then Layer 3 addressing should be investigated. R1# show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID netlab-cs5 Gig 0/0 156 S I WS-C2960- Fas 0/1 R2 Ser 0/0/0 153 R S I CISCO1941 Ser 0/0/0 R1#Solve a Connectivity Problem (2.5.2.2)Finding a missing (or misconfigured) route is a relatively straightforward process, if the right tools are used in a methodical manner. For instance, in this example, the user at PC1 reports that he cannot access resources on the R3 LAN. This can be confirmed by pinging the LAN interface of R3 using the LAN interface of R1 as the source (see Figure 2-71). The results show that there is no connectivity between these LANs.
Figure 2-71 Verify Connectivity to the R3 LAN A traceroute in the following output reveals that R2 is not responding as expected. For some reason, R2 forwards the traceroute back to R1. R1 returns it to R2. This loop would continue until the time to live (TTL) value decrements to zero, in which case, the router would then send an Internet Control Message Protocol (ICMP) Destination Unreachable message to R1. R1# traceroute 192.168.2.1 Type escape sequence to abort. Tracing the route to 192.168.2.1 VRF info: (vrf in name/id, vrf out name/id) 1 172.16.2.2 4 msec 4 msec 8 msec 2 172.16.2.1 12 msec 12 msec 12 msec 3 172.16.2.2 12 msec 8 msec 8 msec 4 172.16.2.1 20 msec 16 msec 20 msec 5 172.16.2.2 16 msec 16 msec 16 msec 6 172.16.2.1 20 msec 20 msec 24 msec 7 172.16.2.2 20 msec R1#The next step is to investigate the routing table of R2, because it is the router displaying a strange forwarding pattern. Using the show ip route | begin Gateway command, the routing table in the following output reveals that the 192.168.2.0/24 network is configured incorrectly. A static route to the 192.168.2.0/24 network has been configured using the next-hop address 172.16.2.1. Using the configured next-hop address, packets destined for the 192.168.2.0/24 network are sent back to R1. It is clear from the topology that the 192.168.2.0/24 network is connected to R3, not R1. Therefore, the static route to the 192.168.2.0/24 network on R2 must use next-hop 192.168.1.1, not 172.16.2.1. R2# show ip route | begin Gateway Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks C 172.16.1.0/24 is directly connected, GigabitEthernet0/0 L 172.16.1.1/32 is directly connected, GigabitEthernet0/0 C 172.16.2.0/24 is directly connected, Serial0/0/0 L 172.16.2.2/32 is directly connected, Serial0/0/0 S 172.16.3.0/24 1/0] via 172.16.2.1 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks C 192.168.1.0/24 is directly connected, Serial0/0/1 L 192.168.1.2/32 is directly connected, Serial0/0/1 S 192.168.2.0/24 [1/0] via 172.16.2.1 R2#The following shows output from the running configuration that reveals the incorrect ip route statement. The incorrect route is removed and the correct route is then entered. R2# show running-config | section ip route ip route 172.16.3.0 255.255.255.0 172.16.2.1 ip route 192.168.2.0 255.255.255.0 172.16.2.1 R2# R2# conf t Enter configuration commands, one per line. End with CNTL/Z. R2(config)# no ip route 192.168.2.0 255.255.255.0 172.16.2.1 R2(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.1 R2(config)#The following output verifies that R1 can now reach the LAN interface of R3. As a last step in confirmation, the user on PC1 should also test connectivity to the 192.168.2.0/24 LAN. R1# ping 192.168.2.1 source g0/0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds: Packet sent with a source address of 172.16.3.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 ms R1#Page 4
In this chapter, you learned how IPv4 and IPv6 static routes can be used to reach remote networks. Remote networks are networks that can only be reached by forwarding the packet to another router. Static routes are easily configured. However, in large networks, this manual operation can become quite cumbersome. Static routes are still used, even when a dynamic routing protocol is implemented. Static routes can be configured with a next-hop IP address, which is commonly the IP address of the next-hop router. When a next-hop IP address is used, the routing table process must resolve this address to an exit interface. On point-to-point serial links, it is usually more efficient to configure the static route with an exit interface. On multi-access networks, such as Ethernet, both a next-hop IP address and an exit interface can be configured on the static route. Static routes have a default administrative distance of 1. This administrative distance also applies to static routes configured with a next-hop address, as well as an exit interface. A static route is only entered in the routing table if the next-hop IP address can be resolved through an exit interface. Whether the static route is configured with a next-hop IP address or exit interface, if the exit interface that is used to forward that packet is not in the routing table, the static route is not included in the routing table. Using CIDR, several static routes can be configured as a single summary route. This means fewer entries in the routing table and results in a faster routing table lookup process. CIDR also manages the IPv4 address space more efficiently. VLSM subnetting is similar to traditional subnetting in that bits are borrowed to create subnets. With VLSM, the network is first subnetted, and then the subnets are subnetted again. This process can be repeated multiple times to create subnets of various sizes. The ultimate summary route is a default route, configured with a 0.0.0.0 network address and a 0.0.0.0 subnet mask for IPv4, and the prefix/prefix-length ::/0 for IPv6. If there is not a more specific match in the routing table, the routing table uses the default route to forward the packet to another router. A floating static route can be configured to back up a main link by manipulating its administrative value. Page 5
The following activities provide practice with the topics introduced in this chapter. The Labs and Class Activities are available in the companion Routing Protocols Lab Manual (978-1-58713-322-0). The Packet Tracer Activities PKA files are found in the online course. Class Activities
Labs
Packet Tracer Activities
9. Check Your Understanding Questions | Next Section Previous Section |