Best Practices for Configuring Administrative Distance in BGP

Administrative distance manipulation in BGP provides powerful route control but requires careful implementation to avoid routing loops and suboptimal paths. This guide covers best practices for modifying BGP administrative distances while maintaining network stability.

Best Practices for Configuring Administrative Distance in BGP

Administrative distance manipulation in BGP represents one of the most powerful yet dangerous configuration techniques available to enterprise network engineers. When implemented correctly, it enables precise control over route selection across complex multi-protocol environments. However, improper configuration can create routing loops, suboptimal paths, and network instability that's difficult to diagnose.

Understanding BGP Administrative Distance Fundamentals

BGP uses three distinct administrative distance values depending on the route source:

  • eBGP routes: 20 (lowest, most trusted)
  • iBGP routes: 200 (highest, least trusted)
  • Locally originated BGP routes: 200

This default hierarchy exists for good reason. The high iBGP administrative distance of 200 ensures that IGP routes (OSPF at 110, EIGRP at 90) are preferred over iBGP, preventing routing loops within the AS. iBGP routes carry the same administrative distance as locally originated routes because both represent internal AS information that should defer to the IGP for intra-AS routing decisions.

eBGP routes with their low administrative distance of 20 will typically take precedence over IGP routes, but this behavior should align with your network design requirements. In some architectures, you may want IGP routes to remain primary with BGP serving as backup connectivity.

Strategic Administrative Distance Modification

Common Scenarios Requiring Distance Modification

Administrative distance changes become necessary in several scenarios:

  • Hybrid routing environments: When integrating BGP into existing IGP-based networks where you need granular control over route preference
  • Redundant connectivity: When you have both BGP and IGP paths to the same destination and need to control primary/backup behavior
  • Traffic engineering: When you need to influence path selection for specific prefixes without modifying BGP attributes globally
  • Migration scenarios: During routing protocol transitions where temporary distance adjustments ease the migration process

Modifying eBGP Administrative Distance

Changing eBGP administrative distance should be approached with extreme caution. The most common scenario involves integrating BGP with existing IGP deployments where you need IGP routes to take precedence over certain BGP routes.

router bgp 65001
 neighbor 192.168.1.1 remote-as 65002
 neighbor 192.168.1.1 distance 150

This configuration sets the administrative distance for routes learned from neighbor 192.168.1.1 to 150, making them less preferred than OSPF routes but more preferred than iBGP routes. Use this technique when you have redundant paths through both BGP and IGP, and you want the IGP path to be the primary route.

Global Distance Modification

For broader control, you can modify administrative distance globally within the BGP process:

router bgp 65001
 distance bgp 20 200 200

The three values represent eBGP, iBGP, and locally originated routes respectively. While the example shows default values, you might increase eBGP distance to 120 in scenarios where you're running BGP primarily for redundancy and want IGP routes to remain primary.

Best Practices for BGP Administrative Distance Configuration

Maintain Routing Hierarchy Consistency

When you configure administrative distance BGP modifications, ensure consistency across all routers in your AS. Inconsistent administrative distance values create asymmetric routing and can lead to traffic engineering nightmares.

Document your distance modifications extensively. Create a routing policy document that clearly states:

  • Which routes should be preferred in each scenario
  • The administrative distance values assigned to each routing protocol
  • Failover behavior expectations

Use Route Maps for Granular Control

Instead of blanket administrative distance changes, consider using route maps for more precise control:

route-map BGP_DISTANCE permit 10
 match ip address prefix-list CRITICAL_ROUTES
 set distance 50

route-map BGP_DISTANCE permit 20
 set distance 150

router bgp 65001
 neighbor 192.168.1.1 remote-as 65002
 neighbor 192.168.1.1 route-map BGP_DISTANCE in

This approach allows you to assign different administrative distances based on specific prefixes, providing surgical control over route preference.

Avoid Common BGP Pitfalls

The most dangerous BGP pitfall when modifying administrative distance is creating routing loops. This typically occurs when:

  • iBGP administrative distance is lowered below IGP values
  • Inconsistent distance values exist across BGP speakers
  • Route redistribution combines with modified distances inappropriately

Always verify your configuration with show ip route and show ip bgp to ensure routes are being selected as expected. Pay particular attention to the path selection process:

R1# show ip bgp 10.1.1.0/24
BGP routing table entry for 10.1.1.0/24, version 2
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     1
  65002
    192.168.1.1 from 192.168.1.1 (192.168.1.1)
      Origin IGP, metric 0, localpref 100, external, best
  65003
    192.168.1.2 from 192.168.1.2 (192.168.1.2)
      Origin IGP, metric 0, localpref 100, external

Routing Optimization Through Distance Tuning

Load Balancing Considerations

Administrative distance modifications can impact load balancing behavior. If you have equal-cost paths through BGP and want to influence which paths are used, consider combining administrative distance changes with BGP attributes like local preference or MED rather than relying solely on distance.

Convergence Impact

Modified administrative distances can affect convergence times. Routes with higher administrative distances may not be installed in the RIB until preferred routes are withdrawn. This can impact failover times in your BGP setup, so test failover scenarios thoroughly in your lab environment.

Verification and Troubleshooting

Use these commands to verify your administrative distance configuration:

# Check route selection in RIB
show ip route 10.1.1.0 255.255.255.0

# Verify BGP database
show ip bgp 10.1.1.0/24

# Check administrative distances
show ip protocols

When troubleshooting routing issues related to administrative distance, always compare the RIB (show ip route) with the BGP table (show ip bgp). Discrepancies often indicate administrative distance conflicts or other route selection issues.

What's Next

Now that you understand administrative distance best practices, the next logical step is exploring BGP path selection attributes in detail. Understanding how Weight, Local Preference, AS Path, and MED interact with administrative distance will give you complete control over route selection in complex BGP environments.

🔧
Use comprehensive network monitoring tools to track routing behavior and quickly identify when administrative distance changes create unexpected path selections or performance issues. PRTG Network Monitor, SolarWinds NPM and Nagios.

Tools and resources for this topic