Understanding Routing Protocols
While routing protocols are complex and have their own set of rules and commands, there are three basic things that you need to know before studying the individual protocols – Administrative Distance, Classes of routing protocols and Routing loops. The following sections look at these three topics in detail.
To understand the importance of Administrative Distance (AD), take a look at the network shown in Figure 4-3.
Figure 4-3 Multiple paths to a destination
Assume that you had one routing protocol between RouterA, RouterB and RouterD while another protocol between RouterA, RouterC and RouterD. (Yes, a router can run multiple routing protocols at the same time). When both the routing protocols tell RouterA about the 192.168.5.0/24 network, which protocol’s route should it choose?
The answer lies in the AD, which is the trustworthiness of routing information received by a router and it depends on the method or protocol by which that route was learned. What this means is, that each protocol has an AD value, which defines the trustworthiness of the routes it tells a router about. This value can be from 0 to 255, with a lower value being better. Each protocol has been assigned a default AD.
When Router1 receives information regarding the same network, 192.168.50./24, from two sources, it will compare the AD value of each source and the one with the lowest value will be selected.
On the other hand, if a single routing protocol was running on all routers, the routing protocol would see the multiple paths to the remote network and choose the best path depending on the metric. A metric, or cost, of a route is calculated differently by each protocol.
Table 4-1 shows the default AD value of various route sources.
Table 4-1 Default AD Values
|Route Source||Default AD Value|
As you can see form the table above, a connected route will be preferred over a static route, while a static route will be selected over any dynamic route. Similary, an EIGRP route will be preferred over an OSPF route. Note that any route with an AD value of 255 will never be used.
It is important to remember the following when it comes to choosing routes:
- When a routing protocol has more than one path to a destination, it will use metrics to present a route to the router.
- When a router is presented with multiple routes to a destination, it will use AD to decide which one to use and will install that route in the routing table.
- Finally when a routers needs to route a packet, it will look at the routing table and use the route longest match prefix (subnet mask). For example, two routes are present in the routing table – 10.1.1.0/24 and 10.1.1.0/28, and a packet destined to 10.1.1.1 is received, the router will select the 10.1.1.0/28 route since it is route with the longest match prefix.
You should note that the ADs given in table 4-1 are default ones and can be changed on any router easily. While changing the AD of dynamic routing protocols is out of CCNA context, you should know how to change the AD of static routes. You will recall that the command to add a static route is:
IOS provides two more options at the end of this command. The complete available command is:
The metric option can be any number between 1 and 255 and that number will become the administrative distance of the static route being added. For example, the following command will add a static route with an AD of 200:
You might ask why you would need to change the AD of a static route. Remember that AD is used to decide the best route when two different sources of routing information are presenting routes to the same destination. A static route is nothing but another source of routing information. By changing its AD to 200 in the above command, the static route is made less trusted then any route to 192.168.5.0/24 presented by dynamic protocols. This is commonly used to add a standby route in case dynamic routing fails. The static route will not be used unless no other source has a route to this destination.
The second option is the permanent keyword that will cause the route to be added to the routing table permanently irrespective of the fact that the next-hop is unknown. Without the permanentkeyword, the route will be removed from the routing table (and not the configuration) if the next-hop is not in the routing table.