Open Shortest Path First or OSPF is an open standard Interior Gateway Protocol (IGP) that is used in an IP network to exchange routing table information within a single Autonomous System (AS). Like other dynamic routing protocols, OSPF does equal cost load balancing, and if you have routes with equal cost paths to the same destination, then OSPF will do load sharing. Unlike Enhanced Interior Gateway Routing Protocol (EIGRP), OSPF can’t do unequal cost load balancing.
Configure OSPF Load Balancing
By default, OSPF allows the installation of up to 4 multiple paths of a single network with identical metrics. This number may be increased to a maximum of 16.
In our example above, the ‘show ip route’ command output will show four different equal cost routes to our host 100.100.100.1/24.
R1#sh ip route
O 100.100.100.0 [110/2] via 22.214.171.124, 00:14:30, GigabitEthernet0/3 [110/2] via 126.96.36.199, 00:15:24, GigabitEthernet0/2 [110/2] via 188.8.131.52, 00:17:08, GigabitEthernet0/1 [110/2] via 184.108.40.206, 00:13:06, GigabitEthernet0/0
Let’s try installing only two routes by using the ‘maximum-paths’ command.
R1(config)#router ospf 1 R1(config-router)#maximum-paths 2
In our routing table, the original four entries were reduced to two.
O 100.100.100.0 [110/2] via 220.127.116.11, 00:00:43, GigabitEthernet0/3 [110/2] via 18.104.22.168, 00:00:43, GigabitEthernet0/2
An OSPF router could load balance the packets on a per-packet or per-destination basis. The default configuration uses per-destination load balancing. The router’s load balancing configuration determines the new or subsequent traffic.
Per-Destination Load Balancing – packets for a given source and destination host pairs are guaranteed to take the same path, even if multiple OSPF paths are available (Per-flow load balancing).
Per-Packet Load Balancing – it uses the round-robin method to determine which path each packet takes to the destination IP. This is inappropriate for certain types of traffic, such as Voice over IP (VoIP), which depends on the packets arriving at the destination in sequence.
We can check which OSPF load balancing method is in effect by using the ‘show ip cef’ command:
R1#sh ip cef 100.100.100.1 detail 100.100.100.0/24, epoch 0, per-destination sharing nexthop 22.214.171.124 GigabitEthernet0/2 nexthop 126.96.36.199 GigabitEthernet0/3
We can change how OSPF load balancing works on the interface configuration mode:
R1(config)#int gi0/3 R1(config-if)#ip load-sharing ? per-destination Deterministic distribution per-packet Random distribution
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: