You want to use a static route only when the dynamic route is not available.
The router will use a floating static route for a particular network prefix only if that same route is not available from the dynamic routing protocol. You can accomplish this by setting the administrative distance of the static route to a value greater than the administrative distance of the dynamic routing protocol:
Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route 10.0.0.0 255.0.0.0 172.16.1.1 190 Router(config)#end Router#
You can use the floating static to trigger a dialer interface as follows:
Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route 0.0.0.0 0.0.0.0 Dialer1 190 Router(config)#end Router#
The static routes that we discussed in the previous section all had relatively low administrative distance values. If the router has two routes to the same destination but with different distances, it will always choose the one with the lower distance value. This concept also includes the routes that come from other sources, such as dynamic routing protocols.
Every routing protocol has an administrative distance that indicates how much the router trusts the information it receives by this method. Table 5-3 shows the default values for these administrative distances. Recipe 5.7 demonstrates how to change these values when they are not appropriate for your network. However, for the current example the default values are sufficient.
|Routing protocol or source||Administrative distance|
|EIGRP summary route||5|
A floating static route is simply one that has an administrative distance value greater than that of the dynamic routing protocol being used. For example, any route that is learned via OSPF will have an administrative distance value is 110 by default. This administrative distance applies to all routes learned by this method regardless of what metric they may have within that protocol.
In the case of static routes, you can directly set the administrative distance for any given static route when you define the route. If the static route's distance value is greater than 110, then any OSPF route that includes this destination is considered better. If OSPF has a route for this destination, the router will use it.
The router will install the floating static route if it doesn't have a similar route from the dynamic routing protocol. Bear in mind, though, that the router will always use the route that has the most precise (longest netmask) match. For example, if the router has learned a route for 10.35.15.0/24 from OSPF, and also has a static route for 10.35.15.0/27, it will use the static route even if it has a higher administrative distance. The administrative distance is used only to decide between competing routes of the same mask length.
Floating static routes are often used to trigger automated backup mechanisms when the routing protocol fails. In this case, you could configure a floating static default route, 0.0.0.0/0, which would point to the dialer interface:
Router(config)#ip route 0.0.0.0 0.0.0.0 Dialer1 190
If the router loses contact with the rest of the network because of a circuit failure, then all of the dynamic routes will drop out of the routing table. The router will then install the floating static route, which will trigger the dial backup connection. We discuss dial backup scenarios in more detail in Chapter 13.
Recipe 5.4; Recipe 5.7; Chapter 13
Router Configuration and File Management
User Access and Privilege Levels
Handling Queuing and Congestion
Tunnels and VPNs
NTP and Time
Router Interfaces and Media
Simple Network Management Protocol
First Hop Redundancy Protocols
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications