« So Much to Know - Truly, Madly, Deeply | Main | Encouraging Book for CCIE Candidates »

Static IP Routing

Let's start at the very beginning
A very good place to start
When you read you begin with A-B-C
When you route you begin with static routing

Okay, so it's really basic and you think you know it. Yeah, you think you don't even need to consider this part. But do you really know every which way you can use static routes? Do you really know how they interact with each other - and especially interact with all the routing protocols?

But you have to start somewhere and this is a really good place to put a stake in the ground. For starters, the documentation for static routes is found under Configuring IP Routing Protocol-Independent Features. Yes, you should look through this document. Even if you're an experienced engineer, this is something you should at least look through. In your workplace, you've probably used static routes, but in a limited way. You probably haven't used them in every way you possibly could use them. And on the test, you may need to use them in ways you wouldn't at work. Remember - on the test you are modeling a network. You are demonstrating the ability to configure features and protocols in any way they can be configured. So you have to know everything deeper than the basics.

So here is what the documentation says about Static Routes:

To configure a static route, use the ip route prefix mask{ip-address| interface-type interface-number[ipaddress]}[distance] [name] [permanent | track number] [tag tag] command in global configuration mode.

So you use "ip route" and then follow with the prefix that you want to route and the mask for that prefix. We all have that part in our left pocket. Easy. Then you tell that route where you want it to go. This could be either the ip-address (next hop) OR interface-type interface-number (fa0/0). Yeah, that's where most of us stop. Maybe now and then you might track the route. But, there's a lot more after the part where you tell where you want the route to go. And there's more to what you already think you know. RTFM.

What's the difference between using the IP address of the next hop and the interface? Is there a difference? Could you use either one? Well, according to the above, you could use either one. That means that the IOS will accept either one - but does not tell you when to use each one and the effects of your choice.

I'm sure by now you've seen this chart:

AD Table

So all static routes have an Administrative Distance of 1. Well, that's if you don't use the distance part of the command. The default is 1. The other interesting item is the difference between routing to an IP address versus using the interface version of the command. Here's why you hear that routing to an address has an AD of 1 and routing to an interface has an AD of 0.

Static routes that point to an interface will be advertised via RIP, EIGRP, and other dynamic routing protocols, regardless of whether redistribute static router configuration commands were specified for those routing protocols. These static routes are advertised because static routes that point to an interface are considered in the routing table to be connected and hence lose their static nature. However, if you define a static route to an interface that is not one of the networks defined in a network command, no dynamic routing protocols will advertise the route unless a redistribute static command is specified for these protocols.
When an interface goes down, all static routes through that interface are removed from the IP routing table. Also, when the software can no longer find a valid next hop for the address specified as the address of the forwarding router in a static route, the static route is removed from the IP routing table.

Remember this. It may be important if you need to use a static route, but don't want to have it automagically inserted into the dynamic routing protocols. Or perhaps you may be presented with a situation where you are asked to redistribute a route without using the redistribute static command. Another potential scenario could be one where you have a static route to an interface, but the interface isn't one of the networks in the network command. So how do you fix that? Do you use the redistribute static or do you use the network command on that interface? Well, again, look at the environment. The diagram "is always right" for the exam. Does your diagram include that interface for that protocol? That will guide your choice. But you have to know what the choices are before you can pick (the correct) one.

Another piece of information (quoted from INE materials) that you may want to remember about the difference between address vs interface:

When routing to a next-hop value the router performs layer 2 to layer 3 resolution on the next-hop address. When routing to an interface the router performs layer 2 to layer 3 resolution on the final destination.

What's in your ARP table? If you can't resolve the layer 2 address, you can't get there, can you? This may become important if proxy arp is disabled or if your static route points to a frame relay interface. You may need to enable proxy arp, add a static arp entry, or a frame relay mapping. It all depends on your particular environment.

But wait, there's more! Think about all the things you can do with static routes if you play with the distance part of the command - combined with varied masks. You can make one route use one path and all the other routes use a different path. If you have a /24 route going out S0/0 and the larger /16 (of the same network) going out S0/1, you can make it happen. Think about this and take it one step further. You can have a /24 route pointing towards S0/0 with a distance of 20 and a /16 route pointing towards S0/1 with a distance of 10 and the /24 will still go out S0/0. IPv4 routing logic uses the longest match - and the AD is only considered when you have routes that have an equal longest match. If you know this, you can do the seemingly impossible - if required. Granted, some of that may fall under the category of "stupid router trick," but I'd rather be able to do it and not have to rather than have to and not be able to do it.