Yet another blog about networking

Menu

Administrative Distance – Only Half the Story

In the image below you can see how each protocol presents itself to the routing table (RIB). The RIB uses AD to determine which route to install. But what about how the protocol chooses which route to present to the RIB?

Each protocol has its own set of rules for route selection, but this is more subtle than just which route has the lowest cost or metric. For example, OSPF has multiple route types that are evaluated before AD.

In this example, both router A and router B are advertising the 10.0.0.0 prefix to router C. Router A should be the lower cost path and should be preferred. What if router A is redistributing the prefix into OSPF?

Router C will have two options:

Internal, Intra-Area Route with Cost of 10 External, Route with cost of 5

Before OSPF looks at the cost it will compare the route type. In this instance the route via B will win and it is what will be presented to the routing table on C. This doesn’t create many problems with OSPF since both internal and external routes have an AD of 110.

If we look at BGP, things get interesting. BGP has two ADs: iBGP with an AD of 200 and eBGP of 20. This can create unexpected scenarios based on what route BGP selects.

Since there is no directly comparable metric in BGP, the BGP best path algorithm has a number of different steps to choose the best route. One of the first steps is simply the AS path length. A shorter AS path list will be the most preferred route. In the following example OSPF is replaced with BGP.

Looking at simply the AS path length, the iBGP path via B will be chosen. When this route is presented to the routing table it will have an AD of 200. This becomes a problem when we expect eBGP to win over an IGP like OSPF

In this example the OSPF route via D will win over both BGP routes. First, BGP will select the best route to present to the RIB (the iBGP path via B). Then the RIB will compare the AD of the iBGP path (200) against the OSPF path (110). The OSPF path wins and the route via D will be used.

Takeaway

Remember that the AD is only half of the story. How each protocol chooses a best route is the other half. Think about the different routes a protocol will have to pick from and which one will be selected and how that will impact path selection based on AD.