top of page

STATIC ROUTING

The route table only shows the live routes.

 

to show all statics you'll need to show what's configured:

 

# show run | inc ip route

You can display all active dynamic static routes with 

 

# show ip route

# show ip route static 

 

after these active routes are added in the main routing table.

 

A characteristic of static routes is that, by default, they use an Administrative Distance (AD) of 1. On the other hand, a directly connected route uses an AD of 0. AD is the feature used by routers in order to select the best path when there are two or more different routes to the same destination; it is a measure of the trustworthiness of the source of the routing information. This is the reason why the static route does not get installed in the Routing Information Base (RIB), because that route is already directly connected, and the static route is less reliable than the connected one.

 

The problem can be due to either of these reasons:

 

  • The IP routing is disabled.
     

  • Next-hop specified for the static route cannot be found as a directly connected host.

ip route
 

It is the command that add new route in routing table.

 

destination_network_#[subnet_mask]
 

This is the first parameter. It specifies the destination network address. We need to provide subnet mask if we are using sub-network. Sub-networks are the smaller network created from one large network in subnetting. If we are not using sub-network then we can omit the subnet mask value. It will parse automatically.

 

IP_address_of_next_hop_neighbor / interface_to_exit
 

This parameter provides a way to reach the destination network. Both commands use separate way to assign this value. First command provides the IP address of next hop neighbor. It tells router that if it receives a packet for destination [that we set in previous parameter], forward that packet to this next hop neighbor IP address.

 

Second command also do the same job but in different way. It specifies exit interface instead of next hop IP address. It tells router that if it receives a packet for the destination specified by previous parameter then exits that packet from this interface. Device attached on other end of this interface will take care of the packet.

 

administrative_distance

Administrative distance is the trustworthiness of route. Route with the lowest AD value will be chosen while forwarding the packet. By default static route has two AD values depending on the previous parameter. If you have used next hop neighbor IP address, then the default AD value will be 1. If you have used exit interface, then the default AD value will be 0. This parameter allows us to create multiple static routes for the same destination. For example we can create primary and backup path for the destination network. To create backup path, we need to set AD value to higher than default, such as 2 or 3. With this configuration router will use primary path. Due to some reason if primary route fails, the router will start using backup route automatically.

 
permanent

When a route goes down router will remove that from routing table. Permanent parameter will keep this route in routing table even if it goes down. Its optional parameter we can omit it. If we omit it, router will remove this route from routing table if it goes down. You might use this parameter for security reason if you never want packets to take another path.

 
Configure Default Route

By default when a packet arrives in interface, router checks destination filed in packet and compare it with routing table. If it finds a match for destination network then it will forward that packet from related interface. If it does not find a match in routing table then it will discard that packet. This is the default behavior of router. Default route allows us to override this behavior. Default route is a way to deal with all unmatched packets. If no match for destination network found in routing table then it would be forwarded to the default route.

Following command will set default route

 

Router(config)# ip route 0.0.0.0 0.0.0.0 IP_address_of_next_hop_neighbor [administrative_distance] [permanent]

Or

 

Router(config)# ip route 0.0.0.0 0.0.0.0 interface_to_exit [administrative_distance] [permanent]

Above command sets destination network to 0.0.0.0/0 that represents all networks.

 
Configure Static Route

Now we know that how IP route command is used to configure the static route. Let's implement it in our example topology. Run following command from global configuration mode in routers.

 
Router0

 

Router(config)#ip route 20.0.0.0 255.0.0.0 192.168.0.254

 
Router1

 

Router(config)#ip route 10.0.0.0 255.0.0.0 192.168.0.253

bottom of page