Static Routes

Static routes are routes you assign in the router configuration. These routes don't change until you reconfigure them yourself. You might ask, "Why not just use static routes and forget all this routing stuff?" Well, if all you had were static routes and something changedperhaps you had to add another subnet, or you changed your Internet service provideryou would have to reconfigure every router to conform to the network changes. It would be impossible to react to short-term changes, such as equipment failures, in all but the simplest networks.

Static routes do have their place in a modern network. They are appropriate for default routes, routes to the null interface, routes to stub networks, and other situations in which the possibility of change is minimal.

To define a static route to network 192.168.11.0 via the router 192.168.5.1, you would use the command:

ip route 192.168.11.0 255.255.255.0 192.168.5.1

 

8.4.1. Default Static Routes

Static routes are commonly used for the default route. A default route is used when a router does not have a specific route to a certain address. The Internet gateway is always a good default route. For example, if our gateway router's IP address is 192.168.2.1, our default route might look like this:

ip route 0.0.0.0 0.0.0.0 192.168.2.1

On the gateway router, the static route could point to the interface that is connected to the Internet:

ip route 0.0.0.0 0.0.0.0 serial 0

The 0.0.0.0 0.0.0.0 route establishes a default only for the current router and the RIP routing protocol. Other routing protocols, such as IGRP and EIGRP, can learn a default route either from another protocol or from an explicit ip default-network command. This command tells IGRP and EIGRP to distribute the default route to other routers. To create a default network, use the ip default-network command. This route is usually created in tandem with the 0.0.0.0 0.0.0.0 route for completeness, as in this example:

! Define the default route for this router
ip route 0.0.0.0 0.0.0.0 192.168.2.1
! Define the default network
ip default-network 192.168.2.0

 

8.4.2. A Static Route to the Null Interface

A static route can be used in conjunction with the null interface to filter unwanted traffic. If we want to drop traffic to the 192.168.3.0 network, we can add a command like this to our router's configuration:

ip route 192.168.3.0 255.255.255.0 null0

This command defines a route for the 192.168.3.0 network to the null interface. The null interface discards all incoming traffic. This method of disposing of unwanted traffic is much more efficient than using an access list.

8.4.3. Backup Static Routes

Static routes are often used to create backup routes that come into effect when a communications link fails. To create backup static routes , you need to use the administrative distance option to the ip route command.

Normally, static routes have an administrative distance of 1, which means they are used in preference to routes learned from a routing protocol. (See Table 8-1 for a complete list of administrative distances.) This isn't how we want a backup route to behave: we want it to be used only as a last resort. Therefore, our backup route should have a higher administrative distance than our primary routes.

Let's assume that our routing protocol is RIP, which has an administrative distance of 120. We want to assign the backup route an administrative distance that's higher than the routing protocol'swe'll choose 125. Here is a configuration with a backup static route to 192.168.9.1 being redistributed into RIP:

! Define our backup static route with a distance of 125
ip route 192.168.11.0 255.255.255.0 192.168.9.1 125
! Configure the RIP information
router rip
 network 192.168.11.0
 network 192.168.9.0

Notice that we are not advertising our backup static route through RIP. (There is no redistribute command.) As a general rule, backup static routes should not be advertised; you'll want to use them only when the routes learned from the dynamic routing protocol (RIP, in this case) are unavailable.

For more information on redistributing routing information, see "Route Redistribution" later in this chapter.

Getting Started

IOS Images and Configuration Files

Basic Router Configuration

Line Commands

Interface Commands

Networking Technologies

Access Lists

IP Routing Topics

Interior Routing Protocols

Border Gateway Protocol

Quality of Service

Dial-on-Demand Routing

Specialized Networking Topics

Switches and VLANs

Router Security

Troubleshooting and Logging

Quick Reference

Appendix A Network Basics

Index

show all menu



Cisco IOS in a Nutshell
Cisco IOS in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596008694
EAN: 2147483647
Year: 2006
Pages: 1031
Authors: James Boney
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net