OSPF Administrative Distance: Mastering Route Priority in the Modern Network

In the world of dynamic routing, choosing the right path to a destination is a dance of metrics and policies. The OSPF Administrative Distance (AD) is the compass that tells your router which route to trust when several protocols advertise a route to the same network. This comprehensive guide delves into the essentials of OSPF Administrative Distance, how it interacts with other routing protocols, practical examples, and strategies for tuning AD to achieve robust and predictable network behaviour.
OSPF Administrative Distance: The Core Concept
OSPF Administrative Distance, commonly referred to as the AD, is a numerical value assigned to routes learned by a routing protocol. The lower the AD, the more preferred the route is. When a router hears the same destination from multiple routing protocols, it compares the AD values and selects the route with the smallest AD. This decision happens before considering the route’s internal metrics, such as OSPF’s cost, making AD a high-level control knob for route selection.
In practice, the OSPF Administrative Distance acts as a hierarchy in multi-protocol environments. If a loopback network is advertised by both OSPF and another routing protocol such as EIGRP or BGP, the router will prioritise the route based on their respective ADs. This is essential in designs where you redistribute routes between protocols or where backup paths exist across different routing domains.
OSP F Administrative Distance: Default Values and Why They Matter
The default OSPF Administrative Distance is a constant across many platforms, reflecting common expectations for how OSPF should be treated in the face of competing sources. For most up-to-date, widely-deployed platforms, OSPF routes carry an AD of 110. This includes routes learned via OSPF internal processes (intra-area and inter-area) as well as routes redistributed into OSPF from other protocols (such as EIGRP or BGP) depending on platform behaviour.
When you compare OSPF Administrative Distance with other routing protocols, the relative order often looks like this on mainstream devices:
- Directly connected networks: AD 0
- Static routes: AD 1
- EIGRP (internal): AD typically around 90
- OSPF: AD typically 110
- RIP: AD 120
- BGP (external): AD 20
- BGP (iBGP): AD 200
It is important to recognise that AD can vary by vendor and platform. While 110 is a widely adopted value for OSPF on many devices, some environments may show slight deviations. Always consult the device’s documentation or run a quick verification command to confirm the exact AD values in your network.
Understanding How OSPF Administrative Distance Interacts with Other Protocols
The Basics: When AD Wins
Consider a scenario where a destination is reachable via OSPF and also via another routing protocol, such as BGP. The router will choose the path associated with the protocol that has the lower AD. If the OSPF Administrative Distance is 110 and the other protocol’s AD is 200, the router will select the OSPF route regardless of the OSPF route’s internal metric, such as cost. The route with the lower AD takes precedence, and only if ADs are identical does the router compare the protocols’ metrics.
Redistribution: A Double-Edged Sword
Redistributing routes between protocols is a common practice in networks that run multiple routing domains. When you redistribute into OSPF, the AD of the routes learned from other protocols becomes a deciding factor. If OSPF receives a route from EIGRP through redistribution, the AD associated with OSPF will be used to determine preference against native OSPF routes. This is where careful planning of AD values, route tagging, and redistribution policies matters to avoid routing loops and suboptimal path selection.
Intra- versus Inter-Domain Considerations
OSPF is designed to function efficiently within an autonomous system (AS). Its AD is typically trusted as a stable and reliable source of routing information within that domain. In juxtaposition, more global or external routing policies (like BGP) carry a different AD that reflects a separate set of trust relationships and administrative controls. The interplay between intra-domain OSPF routes and inter-domain BGP routes is a classic arena for tuning AD to ensure predictable failover and convergence behavior.
Practical Scenarios: How AD Shapes Real-World Routing
Scenario 1: Failover to a Backup Path
In a network that runs both OSPF and a secondary protocol for redundancy, you may want the OSPF route to be preferred under normal conditions but switch to the alternate protocol when the OSPF path becomes unstable. If the AD of the alternate protocol is lower than OSPF (for example, 90 vs 110), you’ll need to adjust the AD values or manipulate redistribution to ensure the intended failover occurs smoothly. Conversely, if OSPF should be the primary protocol, ensuring its AD remains lower than competitors will maintain the preferred path during normal operation.
Scenario 2: Gradual Route Preference Tuning
In networks that gradually migrate from one protocol to another, the ability to tune AD provides a non-disruptive means of steering traffic. For instance, a gradual migration from EIGRP to OSPF can be facilitated by carefully setting AD for the new protocol so that existing paths remain stable while the new protocol’s routes gain traction. Doing so requires a clear plan for redistribution and consistent tagging to prevent route feedback and loops during the transition.
Scenario 3: Maintaining Consistent Policies Across Hubs
Large WANs or data-centre fabrics often rely on consistent routing policies across multiple hubs. The OSPF Administrative Distance plays a key role in maintaining consistent policy when different hubs might receive routes from different sources. By standardising AD values across devices, you can reduce the potential for policy drift and ensure predictable failover behaviour when central routes are redistributed or announced through multiple points of presence.
Viewing and Verifying OSPF Administrative Distance on Common Platforms
Cisco IOS and IOS-XE
On Cisco devices, you can examine how routes are being chosen by looking at the routing table entries. The administrative distance is typically shown alongside each route, often abbreviated as “[AD/Metric]” in route listings. To inspect how OSPF routes are treated relative to others, you can use commands such as:
- show ip route
- show ip protocols
- show ip ospf route
These commands let you see the AD values applied to OSPF routes and how they compare with other protocols advertised for the same destinations. If you need to adjust the AD, Cisco devices provide the distance command to set the administrative distance for OSPF or for specific route types within OSPF (for instance, intra-area versus inter-area). Always test changes in a controlled environment before applying them in production.
Juniper Junos
On Juniper devices, the OSPF Administrative Distance is typically configured and viewed through policy statements and routing-options. You can verify AD settings by inspecting the route table and policy configuration. As with Cisco, the principle remains: the route with the lowest AD is preferred, with OSPF forming the baseline AD in a standard Junos deployment unless explicitly overridden.
Other Vendors
In other vendors such as Huawei, Arista, or multivendor data-centre fabrics, the concept remains the same: AD governs which route source is trusted first. The exact commands differ, but you will generally find commands to display routing tables and protocol-specific AD values, as well as commands to adjust AD for the respective protocols. Always consult the vendor’s documentation to ensure correct syntax and implications of changes.
Tuning OSPF Administrative Distance: Best Practices
When to Adjust AD
Adjust AD when:
- You want to enforce a preferred routing source in a multi-protocol environment.
- You are migrating from one routing protocol to another and need a staged transition.
- You are resolving routing loops caused by redistributing routes between protocols.
- You need to implement policy-based routing that relies on protocol trust levels rather than solely on metrics.
Guidelines for Safe Changes
- Change AD conservatively. Small, incremental changes reduce the risk of unexpected failovers.
- Tag redistributed routes. Route tagging helps prevent routing loops when redistribution occurs between protocols.
- Test in a lab or staging environment before production deployment.
- Document the rationale for AD changes. Clear documentation aids future troubleshooting and audits.
- Consider the impact on failover and convergence time. A lower AD can lead to quicker failover, but may cause flapping if the alternative path is unstable.
Common Scenarios for AD Tuning
- Prefer OSPF over an external protocol during normal operations by ensuring OSPF’s AD remains lower than the other protocol.
- Give priority to static routes or connected routes by lowering AD for those sources, when appropriate, to stabilise primary paths.
- When introducing BGP into an existing OSPF network, carefully plan AD to avoid unintended route changes during redistribution.
Best Practices for Designing with OSPF Administrative Distance
Effective design starts with a clear understanding of how AD interacts with OSPF’s metric (cost) and with other protocols. A well-thought-out AD strategy helps ensure predictable routing behaviour, reduces convergence time surprises, and supports scalable networks. Here are some practical design considerations:
Clear Policy with Predictable Outcomes
Establish a policy that documents which routing sources are preferred for specific destinations or network segments. Use AD as a top-level control to enforce this policy, while using OSPF metrics to fine-tune path selection within the chosen protocol.
Harness Redistribution with Care
Redistribution is a powerful tool but a potential risk if not handled correctly. Use route tagging and limit the redistribution to necessary routes. Align AD values so that redistributed routes behave as intended and do not destabilise the network.
Monitor and Validate
Regularly monitor route changes and convergence times after AD adjustments. Use historical data to validate that the changes deliver the desired reliability and performance improvements.
Common Questions About OSPF Administrative Distance
What is the relationship between OSPF Administrative Distance and OSPF metrics?
Administrative Distance is a higher-level decision factor that supersedes the protocol’s internal metric. OSPF uses its own cost as the metric to determine the best path when multiple routes from the same protocol are available. AD comes into play when you have routes to the same destination from different protocols. In other words, AD selects the protocol; the metric selects the best path within that protocol.
Can AD be modified on all platforms?
Most modern network devices allow some degree of AD modification, but the exact commands and limitations vary by vendor and platform. In critical environments, changes should be carefully planned, documented, and tested before deployment. It is also common to adjust AD for only specific route types or interfaces, rather than applying a global change.
How does AD interact with route summarisation and filtering?
AD affects which routing protocol’s routes are preferred; route summarisation and filtering are separate mechanisms. You can use AD to control protocol preference, while summarisation reduces the routing table size and filtering controls which routes are advertised or accepted. In concert, these tools help simplify management and improve stability.
Conclusion: Mastering OSPF Administrative Distance for Stable, Predictable Networking
OSPF Administrative Distance is a fundamental control in routing strategy. By understanding how the AD shapes route selection across multiple protocols, network engineers can design more robust and resilient networks. Whether you are refining failover policies, migrating between routing protocols, or implementing meticulous redistribution, a clear grasp of OSPF Administrative Distance will empower you to achieve stable, predictable performance. Remember to verify AD values on your devices, document every tuning decision, and test changes in a controlled environment before applying them to production. With thoughtful application, the art and science of OSPF Administrative Distance can significantly enhance the reliability and efficiency of your network.