Skip to content

Routing Statistics

The /routing/stats command provides detailed routing statistics in MikroTik RouterOS, offering visibility into routing subsystem performance, packet processing metrics, and resource utilization. These statistics are essential for diagnosing routing issues, monitoring router performance, and optimizing network operations. The routing statistics subsystem tracks packet and byte counts for both IPv4 and IPv6 routing, provides insights into routing table memory consumption, and exposes hardware offloading utilization metrics.

RouterOS maintains comprehensive statistics for all routing operations, enabling network administrators to monitor routing subsystem health and troubleshoot issues effectively. The statistics system tracks inbound and outbound routing protocol packets, route installation and removal events, FIB (Forwarding Information Base) utilization, and memory allocation for routing data structures. This data is collected continuously and made available through the /routing/stats menu hierarchy, with different commands exposing various aspects of routing performance.

The routing statistics framework serves multiple operational purposes. First, it provides real-time visibility into routing protocol activity, allowing administrators to verify that routing updates are being exchanged correctly between neighbors. Second, it exposes performance metrics that help identify bottlenecks or resource constraints in the routing subsystem. Third, it provides historical counters that can be compared over time to detect trends or anomalies in routing behavior. Finally, it offers debugging information that simplifies troubleshooting when routing issues occur.

RouterOS implements the routing statistics subsystem as a lightweight monitoring layer that has minimal impact on routing performance. Statistics are updated atomically where possible to avoid introducing locking overhead in the critical packet processing path. The system maintains separate counters for different routing protocol types and FIB operations, enabling granular analysis of routing activity without requiring deep packet inspection or logging that would affect router performance.

Understanding routing statistics is fundamental to effective network management. In complex multi-protocol environments where OSPF, BGP, and static routes coexist, statistics provide the visibility needed to verify correct operation and diagnose problems. The /routing/stats command hierarchy exposes this data in a structured format that can be queried interactively, logged for historical analysis, or integrated with external monitoring systems.

PurposeRouting statistics serve as of Routing Statistics

Section titled “PurposeRouting statistics serve as of Routing Statistics”

the diagnostic foundation for any routing-related troubleshooting effort. When routes are not appearing as expected, statistics can reveal whether routing protocol packets are being received and processed correctly. When network performance degrades, routing statistics can indicate whether the FIB is being updated efficiently or whether memory pressure is affecting route installation. When connectivity issues arise, the timing and sequence of routing events captured in statistics can help pinpoint the source of the problem.

The statistics system also supports capacity planning and performance optimization. By monitoring FIB size and growth trends, administrators can anticipate when hardware resource upgrades will be necessary. By tracking routing protocol message rates, they can validate that their network design matches actual traffic patterns. By measuring route installation latency, they can verify that the router is keeping pace with network changes and identify potential bottlenecks before they impact production traffic.

RouterOS routing statistics are organized into logical categories that correspond to different aspects of the routing subsystem. The primary categories include protocol-specific statistics for each routing protocol, FIB statistics that track route table utilization, and system-level statistics that monitor overall routing subsystem performance. Each category contains multiple counters and metrics that together provide a complete picture of routing operations.

Protocol statistics track the exchange of routing information between routers. For dynamic routing protocols like OSPF, BGP, and RIP, these statistics include hello packets sent and received, update packets processed, adjacency state changes, and error conditions encountered. For BGP specifically, statistics also track the number of routes received, advertised, and currently installed in the BGP table.

FIB statistics monitor the routing table that is actually used for forwarding packets. These statistics track the total number of routes in the FIB, memory consumption by routing data structures, the rate of route additions and removals, and the utilization of hardware offloading features where available. FIB statistics are particularly valuable for understanding the router’s forwarding capacity and identifying when route table size approaches hardware limits.

The /routing/stats command provides access to routing statistics through several subcommands that expose different aspects of routing subsystem performance. Each subcommand serves a specific purpose and returns data optimized for different use cases, from real-time monitoring to historical analysis.

The primary /routing/stats command displays aggregate statistics for the entire routing subsystem:

/routing/stats/print

This command returns overall routing statistics including total packet counters, route counts, and memory utilization metrics. The output provides a snapshot of routing subsystem health at the moment the command is executed, suitable for interactive diagnosis and monitoring.

# View routing subsystem statistics
/routing/stats/print
# Monitor statistics continuously
/routing/stats/print interval=1s

The statistics output includes counters for packets processed by the routing subsystem, broken down by direction (inbound and outbound) and protocol type. Memory utilization statistics show the current and peak memory consumption for routing data structures, helping administrators understand resource usage patterns and plan for capacity requirements.

Route-specific statistics provide detailed information about routing table operations:

/routing/stats/route/print

This command displays statistics related to route installation, removal, and modification operations. The output includes counters for successful route operations, failed operations due to resource constraints or configuration errors, and the current rate of route table changes.

# View route operation statistics
/routing/stats/route/print
# Check statistics for specific routing table
/routing/stats/route/print where table=main

Route statistics are particularly valuable when troubleshooting routing convergence issues. By monitoring the rate of route changes, administrators can identify whether the router is experiencing a route flapping event or receiving an excessive number of routing updates. Failed operation counters can reveal configuration problems such as recursive next-hop resolution failures or next-hop reachability issues.

FIB statistics expose details about the Forwarding Information Base utilization and performance:

/routing/stats/fib/print

This command returns statistics about the FIB including total route count, memory usage, and hardware offloading status. FIB statistics are essential for understanding the router’s forwarding capacity and verifying that routes are being installed correctly in the forwarding plane.

# View FIB utilization statistics
/routing/stats/fib/print
# Check FIB for specific address family
/routing/stats/fib/print where family=ipv4

The FIB statistics output includes the total number of routes installed in each FIB table, memory consumption broken down by route type and next-hop category, and information about hardware offloading utilization for platforms that support hardware-based packet forwarding. These statistics help administrators understand whether the router is operating within its forwarding capacity limits.

Protocol-specific statistics are available through the individual routing protocol menus:

/routing/ospf/stats/print
/routing/bgp/stats/print
/routing/rip/stats/print

Each routing protocol maintains its own statistics that track protocol-specific operations. OSPF statistics include neighbor adjacency counts, LSA (Link State Advertisement) processing statistics, and SPF (Shortest Path First) calculation metrics. BGP statistics track peer session information, route advertisement counters, and update processing statistics. RIP statistics include update timer information and route timeout tracking.

# View OSPF protocol statistics
/routing/ospf/stats/print
# View BGP protocol statistics
/routing/bgp/stats/print
# View RIP protocol statistics
/routing/rip/stats/print

Protocol statistics are essential for verifying correct operation of routing protocols and diagnosing protocol-specific issues. OSPF statistics can reveal problems with area configuration or LSA flooding. BGP statistics help identify peer session issues and routing policy problems. RIP statistics provide visibility into update propagation and timeout behavior.

Understanding the routing statistics output requires knowledge of what each counter represents and how to interpret changes over time. This section provides guidance on reading and analyzing the various statistics that the routing subsystem exposes.

Several key metrics in the routing statistics output warrant particular attention for routine monitoring and troubleshooting. The route change rate indicates how dynamically the routing table is being updated, with very high rates potentially indicating route flapping or excessive routing churn. Memory utilization metrics should be monitored to ensure the routing subsystem has sufficient resources and to plan for capacity upgrades before memory exhaustion affects routing operations.

Packet counters for each protocol should be compared against expected values based on network topology and routing configuration. For OSPF, hello packet counts should correspond to the number of configured neighbors. For BGP, update packet counts should reflect the expected route advertisement schedule. Unexpected packet counts may indicate configuration errors, neighbor issues, or routing policy problems.

RouterOS routing statistics include both cumulative counters that increase monotonically and rate-based metrics that indicate activity over time. Cumulative counters are useful for tracking total activity over extended periods and can be compared between time intervals to calculate rates. Rate-based metrics provide immediate visibility into current activity levels and are useful for detecting sudden changes or anomalies.

Error and discard counters are particularly important for troubleshooting. These counters indicate conditions that prevented normal routing operations, such as malformed routing updates, authentication failures, or resource exhaustion. An increase in error counters typically signals a problem that requires investigation, while sustained high error rates usually indicate a persistent configuration or network issue.

Effective use of routing statistics requires establishing baseline values during normal operation. By documenting typical counter values and rate metrics during stable operation, administrators can more easily identify deviations that indicate problems. Baselines should be established for each key metric including route counts, packet rates, memory utilization, and error rates.

When troubleshooting, compare current statistics against established baselines to identify anomalies. A doubling of route change rates may indicate a network problem causing routes to flap. An increase in memory utilization may indicate a route leak or routing loop generating excessive routes. Rising error counters may reveal hardware issues, software bugs, or configuration problems affecting routing operations.

Integrating routing statistics with monitoring systems enables proactive identification of routing issues before they impact network performance. This section describes approaches for collecting and alerting on routing statistics.

For production networks, continuous monitoring of routing statistics provides the earliest warning of routing problems. Monitoring systems should track key metrics including route count stability, packet rates for each routing protocol, memory utilization trends, and error counter rates. Alert thresholds should be set based on established baselines and network requirements.

# Export routing statistics for monitoring
/routing/stats/print
/routing/stats/route/print
/routing/stats/fib/print

Modern monitoring approaches use streaming telemetry to collect routing statistics with minimal overhead. RouterOS supports exporting statistics through various mechanisms including the API, NetFlow, and streaming telemetry protocols. These approaches provide near-real-time visibility into routing operations without the overhead of periodic polling.

Alerting on routing statistics should cover both immediate problems and gradual degradation trends. Immediate alerts should trigger for conditions that require immediate attention such as FIB memory exhaustion, routing protocol session failures, or unexpected route count changes. Trend-based alerts should warn of gradual degradation that may require attention before causing service impact.

# Monitor for FIB memory exhaustion
/routing/stats/fib/print where memory-used > memory-limit * 0.9
# Alert on routing protocol errors
/routing/ospf/stats/print where error-count > 0
/routing/bgp/stats/print where error-count > 0

Alert thresholds should be tuned based on network characteristics and operational requirements. Aggressive thresholds provide early warning but may generate false positives during normal network changes. Conservative thresholds reduce false alarms but may delay problem detection. The appropriate balance depends on the criticality of routing services and the operational team’s tolerance for alerts.

The routing statistics subsystem is designed to have minimal impact on router performance while providing comprehensive visibility into routing operations. Understanding the performance characteristics of statistics collection helps administrators balance monitoring needs against router resource utilization.

Statistics collection in RouterOS is implemented with efficiency as a primary design goal. Most statistics counters are updated atomically during the normal course of packet processing, avoiding the need for additional locking that would impact performance. Counter updates are designed to complete in a small number of CPU cycles, ensuring that statistics collection does not become a bottleneck in the packet processing path.

The primary performance impact of statistics collection comes from maintaining and exposing the statistics data structures. Each counter requires a small amount of memory, and the statistics display commands must iterate through these structures to produce output. On routers with very large route tables or many routing protocol sessions, statistics display commands may take noticeable time to complete.

For routers where statistics collection overhead is a concern, several optimization strategies can reduce impact. Reducing the frequency of statistics polling decreases CPU utilization for monitoring but provides less granular visibility. Disabling unused statistics counters eliminates overhead for features that are not being monitored. Using aggregated statistics rather than detailed per-session counters reduces memory utilization and display time.

# Reduce monitoring polling interval
/routing/stats/print interval=10s
# Disable statistics for unused protocols
/routing/rip/stats/print disabled=yes

Hardware-based forwarding platforms may support statistics collection that is partially or fully offloaded to dedicated hardware. On these platforms, software statistics overhead is reduced while still providing visibility into forwarding operations. Administrators should consult platform documentation to understand hardware offloading capabilities and their impact on statistics collection.

Routing statistics are invaluable for troubleshooting routing issues. This section describes common troubleshooting scenarios and how to use statistics to diagnose problems.

When routes are not converging properly after a network change, routing statistics can reveal where the convergence process is failing. Route change counters indicate whether the router is receiving and processing routing updates. Protocol-specific statistics show whether updates are being exchanged correctly with neighbors. FIB statistics confirm whether routes are being installed in the forwarding plane.

# Check if routes are being received
/routing/bgp/peer/print where state=established
/routing/bgp/peer/print where received-routes-count > 0
# Verify FIB installation
/routing/stats/fib/print where installed-route-count > 0

Route convergence problems often manifest as mismatched route counts between routers or unexpected route flap counters. By comparing statistics across routers in the network, administrators can identify where the convergence process is breaking down and focus troubleshooting efforts accordingly.

Routing protocol session issues can be diagnosed using protocol-specific statistics. BGP session statistics reveal whether peering sessions are established and whether routes are being exchanged. OSPF statistics show neighbor adjacencies and LSA flooding status. RIP statistics track update timer behavior and route timeout processing.

# Diagnose BGP session issues
/routing/bgp/stats/print
/routing/bgp/peer/print detail
# Diagnose OSPF adjacency issues
/routing/ospf/stats/print
/routing/ospf/neighbor/print

Error counters in protocol statistics often provide the clearest indication of session problems. Authentication failures, version mismatches, and other error conditions increment specific error counters that can be queried to identify the root cause of session establishment failures.

When the routing subsystem experiences memory pressure, statistics can help identify the source and guide remediation. FIB statistics show memory consumption by routing data structures. Route statistics indicate the rate of route additions and removals. Protocol statistics reveal whether a particular protocol is generating excessive route entries.

# Check routing memory utilization
/routing/stats/fib/print
/system/resource/print
# Identify routes by protocol
/ip/route/print count-only
/routing/bgp/peer/print where received-routes-count > 0
/routing/ospf/lsdb/print count-only

Memory pressure can cause route installation failures, degraded forwarding performance, and router instability. When memory utilization approaches limits, statistics help identify whether the issue is due to legitimate route growth, a routing loop generating excessive routes, or a memory leak in the routing software.

Effective use of routing statistics requires consistent practices that maximize the value of statistics while minimizing operational overhead.

Establish comprehensive baselines during stable network operation. Document key statistics values including route counts, memory utilization, and packet rates for each routing protocol. Update baselines after significant network changes that alter routing behavior. Use baselines to quickly identify deviations from normal operation.

Integrate statistics collection with monitoring systems for proactive management. Configure alerts for conditions that require immediate attention and for trends that indicate gradual degradation. Tune alert thresholds based on operational experience to balance sensitivity against false positive rates.

Use statistics to guide capacity planning and optimization efforts. Monitor FIB size trends to anticipate hardware upgrade requirements. Track route change rates to identify network design issues or problematic routing behavior. Analyze protocol statistics to optimize routing policy and improve network efficiency.

  • BFD - Bidirectional Forwarding Detection for rapid failure detection
  • PIM-SM - Protocol Independent Multicast Sparse Mode
  • Route Filters - Controlling route propagation
  • Route Management - Route manipulation and optimization
  • FIB Overview - Forwarding Information Base architecture