Skip to content
LinkState
Go back

Policy counters say match but bestpath says otherwise

Introduction to Route-Map Hit Counters

Overview of Route-Maps

Route-maps are a fundamental component of routing policy configuration in network devices, allowing operators to manipulate and filter routes based on various criteria such as prefix, next-hop, community, and more. They are essentially a set of rules that are applied to routes to determine whether they should be accepted, rejected, or modified. Route-maps are widely used in routing protocols like BGP, OSPF, and IS-IS for route filtering, route redistribution, and path manipulation.

Purpose of Hit Counters

Hit counters in route-maps are used to track the number of times a particular route-map clause is matched. This feature is invaluable for troubleshooting and understanding the behavior of route-maps. By analyzing hit counters, network operators can identify which parts of the route-map are being applied to routes, helping in diagnosing issues where the expected routing behavior does not match the actual outcome.

Competing Explanations for Unexpected Route Installation

Policy Evaluation vs. Path Selection

Understanding the distinction between policy evaluation and path selection is crucial in resolving discrepancies between route-map hit counters and installed routes.

Policy Evaluation Process

Policy evaluation refers to the process by which a route-map is applied to a set of routes. The route-map clauses are evaluated in order, and the first clause that matches a route determines the action taken on that route.

Path Selection Process

Path selection involves the router choosing the best path for a route from among multiple available paths. This process is governed by the routing protocol’s best path selection algorithm, which considers factors such as metric, locality, and administrative distance.

Recursion Effects on Route Installation

Recursion can significantly impact route installation, especially when route-maps are involved.

Recursive Route Lookup

Recursive route lookup occurs when the next-hop of a route is not directly connected and the router needs to perform another lookup to determine the outgoing interface.

Mutual Recursion

Mutual recursion happens when two or more routes depend on each other for their next-hop resolution, creating a loop.

Troubleshooting Route-Map Hit Counter Discrepancies

Identifying Route-Map Configuration Issues

Inconsistent or contradictory statements within a route-map can lead to unexpected behavior.

Analyzing Path Selection and Recursion

CLI commands can be used to analyze the path selection process. Debugging recursion effects involves tracing the recursive lookup process.

Code and CLI Examples for Route-Map Configuration and Analysis

Configuring Route-Maps with Hit Counters

route-map EXAMPLE permit 10
 match ip address 1
 set community 100:100
!
route-map EXAMPLE permit 20
 match ip address 2
 set community 200:200

Enabling Hit Counter Logging

route-map EXAMPLE permit 10
 match ip address 1
 set community 100:100
 log

CLI Commands for Route-Map Analysis

show route-map EXAMPLE

Tracing Route Selection and Recursion

debug ip routing

Scaling Limitations and Performance Considerations

Route-Map Complexity and Performance Impact

Large and complex route-maps can significantly impact router performance.

Path Selection and Recursion Limitations

Routers have a maximum recursion depth to prevent infinite loops during recursive route lookups.

Advanced Route-Map Scenarios and Edge Cases

Route-Map Interactions with Other Routing Features

Route-maps are often used in conjunction with route redistribution to filter or modify routes being redistributed between protocols.

Handling Route-Map Conflicts and Precedence

Conflicting route-map statements can be resolved by understanding the order of operations and the specificity of the clauses.

Best Practices for Route-Map Configuration and Management

Designing and Implementing Route-Maps

When designing route-maps, consider the specific routing policies needed, the potential for recursion, and the impact on router performance.

Monitoring and Maintaining Route-Maps

Regular review of route-map configurations is essential to ensure they remain aligned with current routing policies and network topology.


Share this post on:

Previous Post
Ambiguous tickets need competing-hypothesis regression tests
Next Post
Shadow reflectors and phased client cutover