Types of Static Routes Explained
This tutorial explains static network routes, static host routes, fix static routes, and floating static routes. Learn the types of a static route in detail.
A router automatically learns the available networks on its interfaces but it cannot learn the networks available on other router's interfaces. If a network is available on another router’s interface, either you have to manually add a route for the network or have to configure a routing protocol that learns and adds the route for the network. If you manually add a route to the routing table, the route is known as a static route. Routers use the code S to identify a static route in the routing table.
To create and add a static route to the routing table, we use the 'ip route' command. The 'ip route' command needs the following information.
- The destination network or host
- How to reach the destination network or host
- Additional control options
There are four types of a static route. These types are the static network route, static host route, fix static route, and the floating static route. Each type uses the above information in a different way. Let’s discuss the above information and how each type uses the above information.
The destination network or host
This is the destination network or host for which you create the static route. If you create a static route for a network, the route is known as a static network route. And if you create a static route for a host, the route is known as a static host route.
To create a static network route, you have to use the subnet mask of the network. To create a host static host route, you have to use the subnet mask 255.255.255.255.
For example, if you want to create a static route for the network 188.8.131.52/8, then the destination network will be 184.108.40.206 255.0.0.0. Or if you want to create a static route for the host 220.127.116.11/8, then the destination host will be 18.104.22.168 255.255.255.255.
How to reach the destination network or host
This is the method to forward data packets to the destination network or host specified in the previous parameter. You have two methods to forward data packets. You can specify a local interface or the IP address of the next-hop router. If you specify a local interface, the router forwards the destination network’s data packets from the local interface. If you specify the IP address of the next-hop router, the router forwards the destination network’s data packets to the next-hop router.
Let’s take an example.
The following image shows an example network.
In this network, you can use either the value GigbitEthernet0/1 (local interface) or the IP address 22.214.171.124 (next-hop router) on Router0 to forward data packets to the network 126.96.36.199/8 via Router1.
The following image shows the first option.
The following image shows the second option.
Additional control options
The 'ip route' command supports two additional parameters. These parameters are administrative distance and permanent. Routers use the AD (Administrative Distance) value to select the best route from multiple routes to the same destination. Routers select the route that has the lowest administrative distance value.
If you have two routes to the same destination, you can use one route as the main route and another route as the backup route. To configure another route as the backup route, use the administrative distance value of another route higher than the main route.
If multiple routes for the same route exist, the router always uses the route that has the lowest administrative distance value. Since you have configured the administrative distance value of the backup route higher than the main route, the router will not use the backup route as long as the main route is up.
If the main route goes down, the backup route automatically becomes the winner as no route left for the competition.
If the main route turns up again, due to its lower administrative distance value, it becomes the winner again. The router removes the backup route from the routing table and adds the main route again to the routing table.
Since the router adds the backup route to the routing table only when the main route fails and removes the backup route from the routing table as soon as the main route turns up, the backup route is known as the floating static route. A floating static route is a route that the router adds or removes from the routing table as per the link status of the route.
Let’s take the above example network again. In this network, Router0 has two routes for network 188.8.131.52/8. The first route connects Router0 to network 184.108.40.206/8 via Router1. The second route connects Router0 to network 220.127.116.11/8 via Router2 and Router1.
To configure the first route as the main route, you can set its AD value to smaller than the value of the second route. For example, you can set the AD value of the first route to 10 and the AD value of the second route to 20.
By default, the router automatically removes a route from the routing table if the route’s link is down. The permanent parameter overrides this behaviour. If you use this parameter, the router always keeps the route in the routing table no matter whether the route’s link is up or down. This route is known as the fix static route. A fix static route is the route that the router always keeps in the routing table.
This tutorial is the second part of the tutorial "Static Routing Configuration, Commands, and Concepts Explained". The other parts of this tutorial are the following.
That's all for this part of the tutorial. In this part, we discussed types of static routes. In the next part of the tutorial, we will learn how to use the 'ip route' command to configure static routes on routers.
By ComputerNetworkingNotes Updated on 2021-12-31 14:09:30 IST
- Cisco IOS Naming Convention Explained with Examples
- OSPF LSA Types and LSA Flooding Explained
- IGP, EGP, and Autonomous System Explained
- OSPF Fundamental Terminology Explained
- OSPF Features, Advantages, Disadvantages
- Administrative Distance (AD) Explained
- Types of Access Control Lists Explained
- Cisco IOS Backup and Restore Process Step By Step Guide
- RIP Protocol configuration Guide with Examples