Courseiva
OSPFRouter Config

maximum-paths [n]

Configures the maximum number of equal-cost paths that OSPF can install in the routing table for a single destination, enabling load balancing across multiple links.

Definition: maximum-paths [n] is a Cisco IOS router config command. Configures the maximum number of equal-cost paths that OSPF can install in the routing table for a single destination, enabling load balancing across multiple links.

Overview

The `maximum-paths [n]` command in OSPF router configuration mode controls the maximum number of equal-cost paths that OSPF can install in the routing table for a single destination prefix. This command is essential for enabling load balancing across multiple parallel links, improving bandwidth utilization and redundancy. In OSPF, when multiple paths to a destination have the same metric (cost), the router can use up to `n` paths simultaneously, distributing traffic across them.

The default value is typically 4 on Cisco IOS, but can be set from 1 to 16 (or up to 32 on some platforms). This command is particularly useful in networks with redundant links, such as dual-homed connections to an ISP or multiple equal-cost paths in a meshed core. Without this command, OSPF would only install the best path (lowest cost) into the routing table, leaving backup paths unused for load balancing.

The command is configured under the OSPF routing process and affects all routes learned via that OSPF process. It does not affect other routing protocols. When troubleshooting, verifying the number of paths installed can reveal suboptimal load balancing or path selection issues.

The command is immediate and does not require a reload; it modifies the running configuration. Privilege level 15 (enable) is required to enter global configuration mode and then router configuration mode. The output of `show ip route` will display multiple next-hop entries for the same prefix when equal-cost multipath (ECMP) is active.

Note that OSPF must have multiple equal-cost paths available; if costs differ, the command has no effect. Also, the maximum number of paths is limited by the hardware forwarding table capacity; setting a high value may cause issues on older platforms. This command is often used in conjunction with `ip cef` for efficient load balancing.

In summary, `maximum-paths` is a straightforward but powerful tool for optimizing traffic distribution in OSPF networks.

Syntax·Router Config
maximum-paths [n]

When to Use This Command

  • Load balance traffic across two equal-cost OSPF links between routers to increase bandwidth utilization.
  • Configure a maximum of 4 paths in a redundant OSPF network with multiple parallel links to ensure efficient load sharing.
  • Limit the number of paths to 1 to force OSPF to use only the best path, simplifying troubleshooting or meeting specific policy requirements.
  • Increase the maximum paths from default (4) to 8 on high-end routers supporting more ECMP paths for better load distribution.

Parameters

ParameterSyntaxDescription
n<1-16> (or <1-32> on some platforms)Specifies the maximum number of equal-cost paths OSPF can install for a single destination. Valid values range from 1 to 16 (or up to 32 on certain platforms like Cisco 7600 or ASR1000). Setting to 1 disables load balancing. Common mistake: setting a value higher than the number of available equal-cost paths, which has no effect; also forgetting that OSPF must have equal-cost paths (same metric) for multipath to work.

Command Examples

Set maximum paths to 2 for load balancing

maximum-paths 2
Router(config-router)# maximum-paths 2
Router(config-router)# end
Router# show ip route ospf
     10.1.1.0/24 is variably subnetted, 2 subnets, 2 masks
O       10.1.1.0/24 [110/2] via 192.168.1.1, 00:00:12, GigabitEthernet0/0
                    [110/2] via 192.168.2.1, 00:00:12, GigabitEthernet0/1

The command sets OSPF to use up to 2 equal-cost paths. The 'show ip route ospf' output displays two next-hop entries for the same destination (10.1.1.0/24), each with the same metric (110/2), indicating load balancing across two interfaces.

Reset to default maximum paths (4)

no maximum-paths
Router(config-router)# no maximum-paths
Router(config-router)# end
Router# show ip protocols | include maximum
  Maximum path: 4

The 'no maximum-paths' command resets the value to the default (4). The 'show ip protocols' output confirms the maximum path count is 4.

Understanding the Output

The command itself does not produce output; its effect is seen in the routing table. Use 'show ip route' to see multiple next-hop entries for the same destination when ECMP is active. Each entry shows the OSPF-learned route with the administrative distance (110) and metric (cost).

The presence of multiple lines for the same network indicates load balancing. A single entry means only one path is used (either because only one exists or maximum-paths is set to 1). The metric must be equal for paths to be considered equal-cost.

If paths have different metrics, only the best (lowest metric) is installed regardless of the maximum-paths setting.

Configuration Scenarios

Enable OSPF load balancing across three equal-cost links

A company has three parallel WAN links between two routers, each with the same bandwidth and OSPF cost. The goal is to use all three links for load balancing to maximize throughput.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2 R1(Gi0/1)---10.0.13.0/30---(Gi0/1)R2 R1(Gi0/2)---10.0.14.0/30---(Gi0/2)R2

Steps

  1. 1.Step 1: Enter global configuration mode: configure terminal
  2. 2.Step 2: Enter OSPF router configuration: router ospf 1
  3. 3.Step 3: Set maximum paths to 3: maximum-paths 3
  4. 4.Step 4: Exit and verify: end, show ip route 10.0.0.0 255.0.0.0
Configuration
!
router ospf 1
 maximum-paths 3
 network 10.0.0.0 0.255.255.255 area 0
!

Verify: show ip route 10.0.0.0 255.0.0.0 | include 10.0.0.0/8 Expected output: multiple next-hop entries, e.g., O 10.0.0.0/8 [110/2] via 10.0.12.2, 00:00:10, GigabitEthernet0/0 [110/2] via 10.0.13.2, 00:00:10, GigabitEthernet0/1 [110/2] via 10.0.14.2, 00:00:10, GigabitEthernet0/2

Watch out: Ensure all links have the same OSPF cost (e.g., same bandwidth and delay). If one link has a different cost, OSPF will not consider it equal-cost and will not load balance.

Reduce maximum paths to 1 to force single-path routing for troubleshooting

A network engineer suspects that ECMP load balancing is causing asymmetric routing or packet reordering issues. To simplify troubleshooting, they disable multipath by setting maximum-paths to 1.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2 R1(Gi0/1)---10.0.13.0/30---(Gi0/1)R2

Steps

  1. 1.Step 1: Enter global configuration mode: configure terminal
  2. 2.Step 2: Enter OSPF router configuration: router ospf 1
  3. 3.Step 3: Set maximum paths to 1: maximum-paths 1
  4. 4.Step 4: Exit and verify: end, show ip route 10.0.0.0 255.0.0.0
Configuration
!
router ospf 1
 maximum-paths 1
 network 10.0.0.0 0.255.255.255 area 0
!

Verify: show ip route 10.0.0.0 255.0.0.0 Expected output: only one next-hop entry, e.g., O 10.0.0.0/8 [110/2] via 10.0.12.2, 00:00:10, GigabitEthernet0/0

Watch out: After reducing maximum-paths, OSPF will select the best path based on the lowest next-hop IP address (or other tie-breakers). This may cause all traffic to use a single link, potentially overloading it. Ensure this is intended for troubleshooting.

Troubleshooting with This Command

When troubleshooting OSPF load balancing, the `maximum-paths` command is often a starting point. A healthy configuration shows multiple equal-cost paths in the routing table for the same prefix. Use `show ip route [prefix]` to verify the number of installed paths.

If you expect ECMP but see only one path, check that the OSPF costs are truly equal using `show ip ospf interface brief` or `show ip ospf database`. Another useful command is `show ip cef [prefix]` to see how the forwarding table handles ECMP. Common symptoms that this command helps diagnose include: (1) Unequal traffic distribution across links – check if maximum-paths is set too low or if costs differ. (2) Asymmetric routing – if paths are not truly equal, traffic may exit one link and return via another, causing stateful firewall issues. (3) High CPU usage due to excessive ECMP entries – reduce maximum-paths to a lower value.

Step-by-step diagnostic flow: 1. Identify the destination prefix with suspected load balancing issues. 2. Run `show ip route [prefix]` – if multiple next hops appear, ECMP is working.

If not, proceed. 3. Run `show ip ospf interface` to verify OSPF costs on each interface. 4. If costs differ, adjust interface costs using `ip ospf cost` or by changing bandwidth. 5.

If costs are equal but only one path appears, check if `maximum-paths` is set to 1 or lower than the number of equal-cost paths. 6. Verify that the OSPF neighbor relationships are full on all links using `show ip ospf neighbor`. 7. Check for route filtering or administrative distance issues that may override OSPF routes.

Correlate with `debug ip ospf events` to see path selection decisions. Also, note that some platforms have hardware limitations on the number of ECMP entries; `show platform hardware` may reveal drops. In summary, `maximum-paths` is a simple but critical knob; always verify that the expected number of paths is actually installed and that the underlying costs are equal.

CCNA Exam Tips

1.

CCNA exam tip: The default maximum-paths for OSPF is 4, but the exam may ask about the range (1 to 16) or the default (4).

2.

CCNA exam tip: ECMP requires equal cost; OSPF cost is based on bandwidth (reference bandwidth / interface bandwidth). Ensure paths have identical costs for load balancing.

3.

CCNA exam tip: The 'maximum-paths' command is configured in router configuration mode for OSPF, not interface mode.

4.

CCNA exam tip: A common exam scenario: you see multiple routes for the same network in the routing table; the question may ask why or how to limit them.

Common Mistakes

Mistake 1: Setting maximum-paths to a value higher than the number of equal-cost paths available; no effect and no error.

Mistake 2: Forgetting that OSPF must have equal-cost paths; if costs differ, only one path is used even if maximum-paths is high.

Mistake 3: Applying the command in global configuration mode instead of router configuration mode (e.g., 'router ospf 1').

maximum-paths [n] vs show ip ospf interface

Both commands are used in OSPF contexts but serve different purposes: maximum-paths controls load balancing by limiting equal-cost paths, while show ip ospf interface verifies OSPF interface parameters. They are often mentioned together when troubleshooting path selection or OSPF adjacency issues.

Aspectmaximum-paths [n]show ip ospf interface
ScopeRouter configuration mode (global OSPF)Privileged EXEC mode (any context)
Configuration modeRouter(config-router)#Privileged EXEC (#)
PersistenceSaved in running-config and startup-configOutput only, not saved
PrecedenceAffects all OSPF routes globallyShows per-interface state and parameters
Typical useEnable ECMP load balancingVerify OSPF neighbor state and network type

Use maximum-paths [n] when you want to enable or limit equal-cost multipath (ECMP) load balancing for OSPF routes.

Use show ip ospf interface when you need to verify OSPF interface parameters, timers, and neighbor state for troubleshooting.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 series), the `maximum-paths` command syntax is identical to classic IOS, but the maximum value may be higher (up to 32 on some models). The output of `show ip route` is similar, but IOS-XE may display additional flags for ECMP. In NX-OS (Cisco Nexus switches), the equivalent command is `maximum-paths [n]` under `router ospf [instance]`, but the default is 8 and maximum is 64 (or 32 on older models).

NX-OS also supports `ip load-sharing` for per-packet or per-destination load balancing. For ASA firewalls, OSPF is supported in routed mode, and the command is `maximum-paths [n]` under `router ospf [process]`, with a maximum of 8 (ASA 9.x). In IOS-XR (e.g., ASR 9000), the command is `maximum-paths [n]` under `router ospf [process]`, but the default is 32 and maximum is 64.

IOS-XR also uses `load-balancing` configuration for per-flow load balancing. Behaviour differences: In IOS 12.x, the maximum was 6; in 15.x, it increased to 16; in 16.x (IOS-XE), it can be 32. Always check the specific platform documentation.

The command is persistent across reloads and is stored in the running configuration. There is no privilege level requirement beyond enable (15) to configure it.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions