Static Routes
Objective:
- Perform and verify routing configuration tasks for a static or default route given specific routing requirements
When you interconnect routers, as shown in Figure 10.3, they are aware of only their directly connected networks. Unless you configure a static route or use routing protocols, the routers will never know about their neighbors’ other networks, because they are not connected. In other words, Router A is unaware of Router B’s 172.17.0.0 network, and Router B is unaware of Router A’s 172.16.0.0 network.
So when do you use static routes as opposed to routing protocols? As mentioned before, static routes are manual configuration entries in which you tell the router how to get to destination networks that are not locally attached. This is useful in simple networks such as the one shown in Figure 10.3, in which there is a single link in or out of the networks, known as a stub network. Because there is only one link to get to the neighbor network, you don’t need to worry about reacting dynamically if the path fails because there are no alternate paths to that network.
Additionally, if you want to have complete control of your routing path decisions or you want to conserve bandwidth on your links (routing protocols consume bandwidth), static routes can provide you authoritative control without requiring any link bandwidth or resources because they require only a local configuration.
EXAM ALERT
Keep in mind that static routes are used when you have a stub network, want control of your routing decisions, or want to conserve bandwidth on links.
Configuring Static Routes
The general idea behind the static route is to tell the router how to get to a destination network that is not attached to it by going through another router’s interface. It is similar to telling someone, “To go outside, go through that door.” The syntax to configure a static route in global configuration mode is ip route followed by the destination network, destination subnet mask, and the next-hop IP address of the neighbor’s interface. For example, to configure a route to the 10.0.0.0/8 network through the neighbor’s serial interface of 192.168.2.5, the command would look like this:
Router(config)# ip route 10.0.0.0 255.0.0.0 192.168.2.5
NOTE
It is possible to specify the local interface instead of using a next-hop IP address on point-to-point links (a link with only two routers connected to it on each side). On multi-access links such as Ethernet or Frame Relay, you should not use the interface because the local router does not know to which router to forward the information if multiple devices exist on the link.
In the stub network example shown in Figure 10.4, a static route to Router A and one to Router B were added, telling them about their neighbors’ Ethernet networks. These entries are placed in their routing tables, specifying any packets that are destined for those respective networks must go to the IP of the neighbor’s serial 0/0 interface. From that point, the packets are routed out Router A and Router B’s Ethernet interface because those destination networks are directly connected to the router. This entry remains in the routing table as long as the next-hop address remains valid (the serial network does not go down) or the configuration is not removed.
For several reasons such as security, processor resources, and routing path control, you can force the static route to remain in the routing table even if the next-hop interface goes down. This is easily achieved by adding the keyword permanent at the end of the ip route command.
Floating Static Routes
At the end of an ip route static route command, it is possible to add a parameter to assign this particular static route a higher administrative distance than the default administrative distance of 1. These entries, known as floating static routes, are not placed in the routing table if the subnet is being advertised by a routing source with a lower administrative distance. Floating static routes are useful when you have a standby redundant link to another network that will activate in the event of a primary link failure.
For example, consider the example configured in Figure 10.5. Because you have redundant point-to-point links, you can configure the primary static route as usual and include a floating static route to be used if the primary link fails. The 2 at the end of the second static route identifies that route as the floating static route. This entry does not show up in the routing table because the primary route advertises the same subnet with a lower administrative distance (if not specified, the default is 1). If one of the serial 0/0 interfaces on the primary link goes down, the next hop is no longer valid and is removed from the routing table. Because the floating static route has the next lowest administrative distance, that entry is put in the routing table and that link is used until the primary link returns.
EXAM ALERT
If an administrative distance is not specified, a Cisco router uses the default administrative distance for static routes (1). If an administrative distance is specified, it is being used as a floating static route if a redundant link fails.