Static Routes

A static route is a route that is configured manually by the administrator and is never forgotten.

This is the simplest way to tell your router about your network. You, the administrator, tell the router specifically where you want it to route packets with particular destination addresses. The alternative to static routes is to use a routing protocol, and even then a few static routes are usually needed.

Following are a couple of examples of static routes. Generally speaking, on a Cisco router the addresses are destination netmask gateway.

ip route 192.168.8.25 255.255.255.255 192.168.4.13
ip route 192.168.5.0 255.255.255.0 Serial0
ip route 0.0.0.0 0.0.0.0 192.168.1.1
The first route is a route for a specific host. The netmask is 255.255.255.255, or all 1's, indicating that we are not talking about a network, but a specific host. Netmasks are discussed more fully elsewhere. In this case, packets being sent to the computer with the address 192.168.8.25 should be transmitted to the router with the address 192.168.4.13, because that router is the next hop along the way.

The second route is for a block of addresses, 256 addresses. This size block is known as a /24 or a Class C. The netmask, 255.255.255.0 has twenty-four 1 bits followed by eight 0 bits. This basically means that this route applies to any address starting with 192.168.5, and that we should send all packets destined for machines with those addresses out the Serial0 port.

The last route is a default route. The netmask is 0.0.0.0, meaning that the route applies to ALL addresses. Any packet will match this route, and should be sent to the router 192.168.1.1. Remember that more specif routes take precedence over less specific route. If a packet arrives for 192.168.5.44, it will be sent to Serial0 instead of to 192.168.1.1 because there exists a more specific route for the 192.158.5.* network. Default routes are normally useful for Internet routers, but can be useful in some private networks.

Routing to Interfaces

With a Cisco, you can specify a gateway address, an interface, or both. The gateway is the next router along the path to the destination. Normally we can just tell the router to pass the packet to the next router's IP address.

However, sometimes it is more appropriate to simply state what interface to send the packet on. Point-to-point interfaces like a synchronous serial port have only one router at the other end, and we aren't really directing the packet to a specific router's IP address. We may want to indicate that the destination can be found on a broadcast network, like ethernet. (Note that these are two very different cases, and that the router handles them differently.)

In these cases, we can specify the name of the interface instead of the gateway address.