Administrative Distance –
Remember that each network can run, and likely will be running, multiple different routing protocols: OSPF, EIGRP, RIP, RIPV2, IGP, BGP, and IS-IS being the most commonly used, or at least the ones you’ll need to be somewhat familiar with for the CCNA. You’ll spend most of your time learning about OSPF, as it’s the only routing protocol that is on the CCNA exam objectives (OSPFv2.) Because a router will learn multiple routes from different routing protocols, how will the router know which route to choose when it receives the same route from multiple protocols? Well, each protocol has a default administrative distance. This is a value assigned to the routing protocol that measures the ‘trustworthiness’ of a route.
For example, say Router1 has learned a route to 10.1.1.1 from 3 different routing protocols: OSPF, EIGRP, and IS-IS. How will Router1 know which to choose? Based on the default Administrative Distance (AD). The default AD is detailed in the table below for a select few and common routing protocols:
- Connected interface – 0
- Static route – 1
- EIGRP – 90
- OSPF – 110
- RIP – 120
- External EIGRP – 170
- Unknown – 255
A router will always prefer a route it has learned via a direct connection. Second to that, should the directly connected interface fail, an assigned static route provided by the Administrator would be the fallback. Continuing with our scenario, we now know that Router1 will choose the EIGRP route over OSPF and IS-IS unless the Administrator changes the default values for Router1 to prefer one route over another. Additionally, if the EIGRP route were to fail, the OSPF route would act as the fallback.
Helpful commands to know, though not necessary for the CCNA:
- (In global) show ip route
- (To change the default AD value)
- (In config) route [routing protocol, ex. rip]
- (config-router)distance 90
Longest Prefix Match, Prefix Matching, Longest Match –
A router uses this process to find a match between the destination IP address of the packet and a routing entry in the routing table. For example (credit to Allan Johnson’s 31 Days To Your CCNA for this example), if we have 3 Routes in the Router:
- 1: 172.16.0.0/12
- 2: 172.16.0.0/18
- 3: 172.16.0.0/26
And we have a packet that has a destination address of 172.16.0.10, which route will the router choose to forward the packet to? Simple, the route with the longest prefix match. We determine this by knowing the binary behind the IP address and subnet mask. The route with the longest matching string of binary numbers wins and is the chosen route.
- Destination 172.16.0.10 – Binary – 10101100.00010000.00000000.00001010
- 1: 172.16.0.0/12 – Binary – 10101100.00010000.00000000.00001010
- 2: 172.16.0.0/18 – Binary – 10101100.00010000.00000000.00001010
- 3: 172.16.0.0/26 – Binary – 10101100.00010000.00000000.00001010
In this case, all of them match the destination address, however, the longest match in this example is route number 3.
This is a shorter lesson, but more condensed and concise to boil down to exactly what is necessary to pass the CCNA. As always, should you have any questions or concerns, feel free to reach out to me.
Have a happy, productive day, and keep learning!