Chapter 2: Static Routing
Routing is at the core of every data network, moving information across an internetwork from source to destination. Routers are the devices responsible for the transfer of packets from one network to the next.
Routers learn about remote networks either dynamically, using routing protocols, or manually, or using static routes. In many cases, routers use a combination of both dynamic routing protocols and static routes. This chapter focuses on static routing.
Static routes are very common and do not require the same amount of processing and overhead as dynamic routing protocols.
In this chapter, sample topologies will be used to configure IPv4 and IPv6 static routes and to present troubleshooting techniques. In the process, several important IOS commands and the resulting output will be examined. An introduction to the routing table using both directly connected networks and static routes will be included.
2.0 Activity - Which Way Should We Go
Activity - Which Way Should We Go?
A huge sporting event is about to take place in your city. To attend the event, you make concise plans to arrive at the sports arena on time to see the entire game.
There are two routes you can take to drive to the event:
- Highway route - It is easy to follow and fast driving speeds are allowed.
- Alternate, direct route - You found this route using a city map. Depending on conditions, such as the amount of traffic or congestion, this just may be the way to get to the arena on time.
With a partner, discuss these options. Choose a preferred route to arrive at the arena in time to see every second of the huge sporting event.
Compare your optional preferences to network traffic, which route would you choose to deliver data communications for your small- to medium-sized business? Would it be the fastest, easiest route or the alternative, direct route? Justify your choice.
Complete the modeling activity .pdf and be prepared to justify your answers to the class or with another group.
Class Activity - Which Way Should We Go? Instructions
2.1 Reach Remote Networks
A router can learn about remote networks in one of two ways:
- Manually - Remote networks are manually entered into the route table using static routes.
- Dynamically - Remote routes are automatically learned using a dynamic routing protocol.
Figure 1 provides a sample scenario of static routing. Figure 2 provides a sample scenario of dynamic routing using EIGRP.
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.
2.1.1 Why Use Static Routing?
Static routing provides some advantages over dynamic routing, including:
- Static routes are not advertised over the network, resulting in better security.
- Static routes use less bandwidth than dynamic routing protocols, no CPU cycles are used to calculate and communicate routes.
- The path a static route uses to send data is known.
Static routing has the following disadvantages:
- Initial configuration and maintenance is time-consuming.
- Configuration is error-prone, especially in large networks.
- Administrator intervention is required to maintain changing route information.
- Does not scale well with growing networks; maintenance becomes cumbersome.
- Requires complete knowledge of the whole network for proper implementation.
In the figure, dynamic and static routing features are compared. Notice that the advantages of one method are the disadvantages of the other.
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, recall that the administrative distance (AD) value is a measure of the preference of route sources. Route sources with low AD values are preferred over routes sources with higher AD values. The AD value for a static route is 1. Therefore, a static route will take precedence over all dynamically learned routes, which will have higher AD values.
2.1.2 When to Use Static Routes
Static routing has three primary uses:
- Providing ease of routing table maintenance in smaller networks that are not expected to grow significantly.
- Routing to and from stub networks. A stub network is a network accessed by a single route, and the router has only one neighbor.
- Using a single default route to represent a path to any network that does not have a more specific match with another route in the routing table. Default routes are used to send traffic to any destination beyond the next upstream router.
The figure 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.
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.
2.1.3 Activity - Identify the Advantages and Disadvantages of Static Route
Instruction
Determine whether the static routing descriptors are advantages or disadvantages of static routing . Click the appropriate field next to each description to indicate your answers.
2.1.2.1 Static Route Applications
As shown in the figure, 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:
- Reduce the number of routes advertised by summarizing several contiguous networks as one static route
- Create a backup route in case a primary route link fails
The following types of IPv4 and IPv6 static routes will be discussed:
- Standard static route
- Default static route
- Summary static route
- Floating static route
2.1.2.2 Standard Static Route
Both IPv4 and IPv6 support the configuration of static routes. Static routes are useful when connecting to a specific remote network.
The figure shows that R2 can be configured with a static route to reach the stub network 172.16.3.0/24.
Note: The example is highlighting a stub network, but in fact, a static route can be used to connect to any network.
2.1.1.3 Default Static Route
A default route is a route that matches all packets and is used by the router if a packet does not match any other, more specific route in the routing table. A default route can be dynamically learned or statically configured. 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:
- When no other routes in the routing table match the packet destination IP address. In other words, when a more specific match does not exist. A common use is when connecting a company's edge router to the ISP network.
- When a router has only one other router to which it is connected. In this situation, the router is known as a stub router.
Refer to the figure for a stub network default route scenario.
2.1.1.4 Summary Static Route
To reduce the number of routing table entries, multiple static routes can be summarized into a single static route if:
- The destination networks are contiguous and can be summarized into a single network address.
- The multiple static routes all use the same exit interface or next-hop IP address.
In the figure, 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.
2.1.1.5 Floating Static Route
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. 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 the figure, 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.
Activity - Identify the Type of Static Route
Instruction
Determine whether the static routing descriptors are advantages or disadvantages of static routing . Click the appropriate field next to each description to indicate your answers.
2.2.1.1 ip route Command
Static routes are configured using the ip route global configuration command. The basic syntax for the command is shown in the figure.
The following parameters are required to configure static routing:
- network-address - Destination network address of the remote network to be added to the routing table, often this is referred to as the prefix.
- subnet-mask - Subnet mask, or just mask, of the remote network to be added to the routing table. The subnet mask can be modified to summarize a group of networks.
One or both of the following parameters must also be used:
- ip-address - The IP address of the connecting router to use to forward the packet to the remote destination network. Commonly referred to as the next hop.
- exit-intf - The outgoing interface to use to forward the packet to the next hop.
The distance parameter is used to create a floating static route by setting an administrative distance that is higher than a dynamically learned route.
Router (config) # ip route network-address subnet-mask { ip-address | exit-intf }
2.2.1.2 Next-Hop Options
In this example, Figures 1 to 3 display the routing tables of R1, R2, and R3. Notice that each router has entries only for directly connected networks and their associated local addresses. None of the routers have any knowledge of any networks beyond their directly connected interfaces.
For example, R1 has no knowledge of networks:
- 172.16.1.0/24 - LAN on R2
- 192.168.1.0/24 - Serial network between R2 and R3
- 192.168.2.0/24 - LAN on R3
Figure 4 displays a successful ping from R1 to R2. Figure 5 displays an unsuccessful ping to the R3 LAN. This is because R1 does not have an entry in its routing table for the R3 LAN network.
The next hop can be identified by an IP address, exit interface, or both. How the destination is specified creates one of the three following route types:
- Next-hop route - Only the next-hop IP address is specified
- Directly connected static route - Only the router exit interface is specified
- Fully specified static route - The next-hop IP address and exit interface are specified
2.2.1.3 Configure a Next-Hop Static Route
In a next-hop static route, only the next-hop IP address is specified. The exit interface is derived from the next hop. For example, in Figure 1, three next-hop static routes are configured on R1 using the IP address of the next hop, R2.
Before any packet is forwarded by a router, the routing table process must determine the exit interface to use to forward the packet. This is known as route resolvability.
Figure 2 details the basic packet forwarding process in the routing table for R1. When a packet is destined for the 192.168.2.0/24 network, R1:
1. Looks for a match in the routing table and finds that it has to forward the packets to the next-hop IPv4 address 172.16.2.2, as indicated by the label 1 in the figure. Every route that references only a next-hop IPv4 address and does not reference an exit interface must have the next-hop IPv4 address resolved using another route in the routing table with an exit interface.
2. R1 must now determine how to reach 172.16.2.2; therefore, it searches a second time for a 172.16.2.2 match. In this case, the IPv4 address matches the route for the directly connected network 172.16.2.0/24 with the exit interface Serial 0/0/0, as indicated by the label 2 in the figure. This lookup tells the routing table process that this packet is forwarded out of that interface.
It actually takes two routing table lookup processes to forward any packet to the 192.168.2.0/24 network. When the router performs multiple lookups in the routing table before forwarding a packet, it is performing a process known as a recursive lookup. Because recursive lookups consume router resources, they should be avoided when possible.
A recursive static route is valid (that is, it is a candidate for insertion in the routing table) only when the specified next hop resolves, either directly or indirectly, to a valid exit interface. If the exit interface is “down” or “administratively down”, then the static route will not be installed in the routing table.
Use the Syntax Checker in Figures 3 and 4 to configure and verify next-hop static routes on R2 and R3.
2.2.1.4 Configure a Directly Connected Static Route
When configuring a static route, another option is to use the exit interface to specify the next-hop address.
In Figure 1, three directly connected static routes are configured on R1 using the exit interface. The routing table for R1 in Figure 2 shows that when a packet is destined for the 192.168.2.0/24 network, R1 looks for a match in the routing table, and finds that it can forward the packet out of its Serial 0/0/0 interface. No other lookups are required.
Notice how the routing table looks different for the route configured with an exit interface than for the route configured with a recursive entry.
Configuring a directly connected static route with an exit interface allows the routing table to resolve the exit interface in a single search, instead of two searches. Although the routing table entry indicates “directly connected”, the administrative distance of the static route is still 1. Only a directly connected interface can have an administrative distance of 0.
Note: For point-to-point interfaces, you can use static routes that point to the exit interface or to the next-hop address. For multipoint/broadcast interfaces, it is more suitable to use static routes that point to a next-hop address.
Use the Syntax Checker in Figures 3 and 4 to configure and verify directly connected static routes on R2 and R3.
Note: CEF (Cisco Express Forwarding) is the default behavior on most platforms running IOS 12.0 or later. CEF provides optimized lookup for efficient packet forwarding by using two main data structures stored in the data plane: a FIB (Forwarding Information Base), which is a copy of the routing table, and an adjacency table that includes Layer 2 addressing information. The information combined in both of these tables work together so there is no recursive lookup needed for next-hop IP address lookups. In other words, a static route using a next-hop IP requires only a single lookup when CEF is enabled on the router. Although static routes that use only an exit interface on point-to-point networks are common, the use of the default CEF forwarding mechanism makes this practice unnecessary. CEF is discussed in more detail later in the course.
2.2.1.5 Configure a Fully Specified Static Route
Fully Specified Static Route
In a fully specified static route, both the exit interface and the next-hop IP address are specified. This is another type of static route that is used in older IOSs, prior to CEF. This form of static route is used when the exit interface is a multi-access interface and it is necessary to explicitly identify the next hop. The next hop must be directly connected to the specified exit interface.
Suppose that the network link between R1 and R2 is an Ethernet link and that the GigabitEthernet 0/1 interface of R1 is connected to that network, as shown in Figure 1. CEF is not enabled. To eliminate the recursive lookup, a directly connected static route can be implemented using the following command:
R1(config)# ip route 192.168.2.0 255.255.255.0 GigabitEthernet 0/1
However, this may cause unexpected or inconsistent results. The difference between an Ethernet multi-access network and a point-to-point serial network is that a point-to-point serial network has only one other device on that network, the router at the other end of the link. With Ethernet networks, there may be many different devices sharing the same multi-access network, including hosts and even multiple routers. By only designating the Ethernet exit interface in the static route, the router will not have sufficient information to determine which device is the next-hop device.
R1 knows that the packet needs to be encapsulated in an Ethernet frame and sent out the GigabitEthernet 0/1 interface. However, R1 does not know the next-hop IPv4 address; therefore, it cannot determine the destination MAC address for the Ethernet frame.
Depending upon the topology and the configurations on other routers, this static route may or may not work. It is recommended that when the exit interface is an Ethernet network, that a fully specified static route is used, including both the exit interface and the next-hop address.
As shown in Figure 2, when forwarding packets to R2, the exit interface is GigabitEthernet 0/1 and the next-hop IPv4 address is 172.16.2.2.
Note: With the use of CEF, a fully specified static route is no longer necessary. A static route using a next-hop address should be used.
Use the Syntax Checker in Figure 3 and 4 to configure and verify fully specified static routes on R2 and R3.
2.2.1.6 Verify a Static Route
Along withpingandtraceroute, useful commands to verify static routes include:
- show ip route
- show ip route static
- show ip route network
Figure 1 displays sample output of the show ip route static command. In the example, the output is filtered using the pipe and begin parameter. The output reflects the use of static routes using the next-hop address.
Figure 2 displays sample output of the show ip route 192.168.2.1 command.
Figure 3 verifies the ip route configuration in the running configuration.
Use the Syntax Checker in Figure 4 to verify the routing settings of R2.
Use the Syntax Checker in Figure 5 to verify the routing settings of R3.
2.2.2.1 Default Static Route
Routers commonly use default routes that are either configured locally or learned from another router, using a dynamic routing protocol. A default route does not require any left-most bits to match between the default route and the destination IPv4 address. A default route is used when no other routes in the routing table match the destination IP address of the packet. In other words, if a more specific match does not exist, then the default route is used as the Gateway of Last Resort.
Default static routes are commonly used when connecting:
- An edge router to a service provider network
- A stub router (a router with only one upstream neighbor router)
As shown in the figure, the command syntax for a default static route is similar to any other static route, except that the network address is0.0.0.0 and the subnet mask is 0.0.0.0.
Note: An IPv4 default static route is commonly referred to as a quad-zero route.
Router (config) # ip route 0.0.0.0 0.0.0.0 (ip-address | exit-int)
2.2.2.2 Configure a Default Static Route
R1 can be configured with three static routes to reach all of the remote networks in the example topology. However, R1 is a stub router because it is only connected to R2. Therefore, it would be more efficient to configure a default static route.
The example in the figure configures a default static route on R1. With the configuration shown in the example, any packets not matching more specific route entries are forwarded to 172.16.2.2.
2.2.2.3 Verify a Default Static Route
In the figure, the show ip route static command output displays the contents of the static routes in the routing table. Note the asterisk (*)next to the route with code ‘S’. As displayed in the Codes table in the figure, the asterisk indicates that this static route is a candidate default route, which is why it is selected as the Gateway of Last Resort.
The key to this configuration is the /0 mask. The subnet mask in a routing table determines how many bits must match between the destination IP address of the packet and the route in the routing table. A binary 1 indicates that the bits must match. A binary 0 indicates that the bits do not have to match. A /0 mask in this route entry indicates that none of the bits are required to match. The default static route matches all packets for which a more specific match does not exist.
We are here to help you!
Thank you for sharing the information.
ReplyDeleteFortinet Certified Partner
Certified Paloalto Partner