Last time we talked about the IPv4 routing table and how the information populates it in the first place, starting with directly connected routes. The fact that interfaces with these routes have to be up and functioning to be in the table at all makes them inherently “believable” (the term used to describe routes). Routes in the IPv4 routing table from this source are marked with a C (connected) and easily recognizable.
That brings us to the topic of static routes, which may evoke images of lightning (see above), or walking across a carpeted room and sending a shock to someone just for fun. Certainly the word static is used in those contexts, but in this case it simply means fixed or stationary, and refers to the fact that these routes stay permanently in the routing table. You might think that this sounds like a description of connected routes too, but in reality it means that the routes are manually configured by a network administrator.
You can think of static routes in terms of the large concrete barricades that separate the sides of traffic on the highway. First, they stay in one place, they do not move, even when an object may strike them with some degree of force. Static routes remain in the table once configured and do not simply vanish when things are taking place from a routing perspective. Second, these barriers unforgivingly separate traffic, just as static routes continually direct traffic to their intended destination. Finally, these concrete dividers are actually put there by highway workers, they do not simply magically appear, just as static routes have to be placed manually in the router’s configuration.
The configuration of a static is remarkably straightforward and uncomplicated, using the following syntax:
ip route <destination-prefix> <subnet-mask> <next-hop-address | exit-interface> [<distance>]
The destination prefix is a subnet and/or network using standard decimal notation (e.g., 192.168.2.0), followed by a subnet mask, just as you probably have seen and used numerous times in your networking job and/or studies. The next part is critical to understand, as you have options you need to consider. You can choose simply to specify the outgoing interface, or you can specify the IPv4 address of the device you want to send the traffic to (typically directly connected). In either case, if the interface is down and/or the next hop is unreachable, the route will not appear in the table. The optional distance command allows you to specify the administrative distance, which we will cover next time!
– Joe