Static routes

Static routes are manually added to a routing table through direct configuration. Using a static route, a router can learn about a route to a remote network that is not directly attached to one of its interfaces. Note that, however, static routes are not widely used today, since you have to configure each static route manually on each router in the network.

Static routes are configured in the global configuration mode using the ip route DESTINATION_NETWORK SUBNET_MASK NEXT_HOP_IP_ADDRESS command. The NEXT_HOP_IP_ADDRESS parameter is the IP address of the next-hop router that will receive packets and forward them to the remote network. The router with the next-hop IP address must be on a directly connected network.

Consider the following example:

static routes example

Let’s take a look at the routing table on R1:

static routes 1

Note that R1 knows about the two directly connected networks: 10.0.0.0/24 and 172.16.0.0/24. What it doesn’t know about, however, is the 192.168.0.0/24 network directly attached to R2. Let’s try to ping a host in that network:

static routes ping fails

The ping command fails because R1 doesn’t know where to send the packets. However, we can specify a static route that will rectify this problem:

ip route command

With the command above, we’ve instructed R1 to send all packets destined for the 192.168.0.0/24 network to the IP address of 172.16.0.2 (the IP address of the Fa0/1 interface on R2). Let’s try to ping that same host again:

static routes ping successful

Because R1 now knows where to send packets, the ping command is successful.

 

We could have also specified the exit interface of the local router (R1) instead of the next-hop IP address in the ip route command. In our example, the command would be ip route 192.168.0.0 255.255.255.0 Fa0/1.

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019