Static Routing

As discussed previously, a router can learn about remote networks in one of two ways:

■ Manually, from configured static routes
■ Automatically, from a dynamic routing protocol

This section looks at static routes and configuring static routes. Dynamic routing protocols are introduced in the next section.

Static routes are commonly used when routing from a network to a stub network. A stub network is a network accessed by a single route.
The diagram below shows a network that is ideally suited to static routing, you will see that any network attached to R1 would only have one way to reach other destinations, whether to networks attached to R2 or to destinations beyond R2. Therefore, network is a stub network and R1 is a stub router.


Running a routing protocol between R1 and R2 is a waste of resources because R1 has only one way out for sending non-local traffic. Therefore, static routes are configured for connectivity to remote networks that are not directly connected to a router. Again, referring to the figure, you would configure a static route on R2 to the LAN attached to R1. You will also see how to configure a default static route from R1 to R2 later in the chapter so that R1 can send traffic to any destination beyond R2.

ip route Command

The command for configuring a static route is ip route. The complete syntax for configuring

a static route is Router(config)# ip route network-address subnet-mask {ip-address or exit-interface}

The following parameters are used:

■ network-address: Destination network address of the remote network to be added to the routing table. (Equivalent to the prefix parameter in the complete syntax.)

■ subnet-mask: Subnet mask of the remote network to be added to the routing table. The subnet mask can be modified to summarise a group of networks. (Equivalent to the mask parameter in the complete syntax.)

One or both of the following parameters must also be used:

■ ip-address: Commonly referred to as the next-hop router’s IP address. (Equivalent to the ip-address parameter in the complete syntax.)

■ exit-interface: Outgoing interface that would be used in forwarding packets to the destination network. (Equivalent to the interface-type interface-number parameter in the complete syntax.)

The ip-address parameter is commonly referred to as the “next-hop” router’s IP address. The actual next-hop router’s IP address is commonly used for this parameter.

To have IOS messages display when the new route is added to the routing table, you can use the debug ip routing command. To cancel this debig command, type undebug all.  The debig facility is very useful for troubleshooting but it uses a lot of processing power and can adversely affect the performance of the router.

Every router makes its decision alone, based on the information it has in its own routing table.

The fact that one router has certain information in its routing table does not mean that other routers have the same information. Routing information about a path from one network to another does not provide routing information about the reverse, or return, path.

In this section you have learned how static routes can be used to reach remote networks. Remote networks are networks that can only be reached by forwarding the packet to another router.
Static routes are easily configured. However, in large networks, this manual operation can become quite cumbersome. As you will see in later, static routes are still used, even when a dynamic routing protocol is implemented.

Static routes can be configured with a next-hop IP address, which is commonly the IP address of the next-hop router. When a next-hop IP address is used, the routing table process must resolve this address to an exit interface. On point-to-point serial links, it is usually more efficient to configure the static route with an exit interface. On multi-access networks such as Ethernet, both a next-hop IP address and an exit interface should be configured on the static route.

Static routes have a default administrative distance of 1. This administrative distance also applies to static routes configured with a next-hop address as well as an exit interface.

A static route will only be entered in the routing table if the next-hop IP address can be resolved through an exit interface. Regardless of whether the static route is configured with a next-hop IP address or exit interface, if the exit interface—the directly connected network that is used to forward that packet—is not in the routing table, the static route will not be included in the routing table.

In many cases, several static routes can be configured as a single summary route. This means fewer entries in the routing table and results in a faster routing table lookup process. The ultimate summary route is a default route, configured with a network address and a subnet mask. If there is not a more specific match in the routing table, the routing table will use the default route to forward the packet to another router.

Next – Dynamic Routing Protocols