What is OSPF load balancing and why to use it?

Load balancing is a standard functionality of the Cisco IOS router software, and is available across all router platforms. It is inherent to the forwarding process in the router and is automatically activated if the routing table has multiple paths to a destination. It is based on standard routing protocols, such as Routing Information Protocol (RIP), RIPv2, Enhanced Interior Gateway Routing Protocol (EIGRP), Open Shortest Path First (OSPF), and Interior Gateway Routing Protocol (IGRP), or derived from statically configured routes and packet forwarding mechanisms. It allows a router to use multiple paths to a destination when forwarding packets.

In the example below we will configure four routers and two end-user devices. In the event of a network outage computers must continue to have access to the server infrastructure. Each router will have a redundant connection to one or more network segments and run a OSPF routing process operating in OSPF area 0. To accommodate network redundancy we must configure dynamic routing to install multiple paths that can be used to load balancing traffic. All paths will use the same bandwidth with no alterations beyond the configurations shown.

Steps to configure OSPF equal cost load balancing

Step 1: Configure all applicable router interfaces.

R1(config)#interface FastEthernet0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.0
!
R1(config)#interface FastEthernet1/0
R1(config-if)#ip address 10.3.0.2 255.255.255.252
!
R1(config)#interface FastEthernet1/1
R1(config-if)#ip address 10.1.0.1 255.255.255.252
R2(config)#interface FastEthernet0/0
R2(config-if)#ip address 10.6.0.1 255.255.255.0
!
R2(config)#interface FastEthernet1/0
R2(config-if)#ip address 10.4.0.2 255.255.255.252
!
R2(config)#interface FastEthernet1/1
R2(config-if)#ip address 10.2.0.1 255.255.255.252
R3(config)#interface FastEthernet0/0
R3(config-if)#ip address 10.3.0.1 255.255.255.252
!
R3(config)#interface FastEthernet0/1
R3(config-if)#ip address 10.2.0.2 255.255.255.252
!
R3(config)#interface FastEthernet1/0
R3(config-if)#ip address 10.5.0.1 255.255.255.252
R4(config)#interface FastEthernet0/0
R4(config-if)#ip address 10.1.0.2 255.255.255.252
!
R4(config)#interface FastEthernet0/1
R4(config-if)#ip address 10.4.0.1 255.255.255.252
!
R4(config)#interface FastEthernet1/0
R4(config-if)#ip address 10.5.0.2 255.255.255.252

Step 2: Enable a OSPF routing process with a common AS number and enable OSPF routing on all applicable IP networks.

R1(config)#router ospf 101
R1(config-router)#maximum-paths 2
R1(config-router)#network 10.0.0.0 0.0.0.255 area 0
R1(config-router)#network 10.1.0.0 0.0.0.3 area 0
R1(config-router)#network 10.3.0.0 0.0.0.3 area 0
R2(config)#router ospf 101
R2(config-router)# maximum-paths 2
R2(config-router)# network 10.2.0.0 0.0.0.3 area 0
R2(config-router)# network 10.4.0.0 0.0.0.3 area 0
R2(config-router)# network 10.6.0.0 0.0.0.255 area 0
R3(config)#router ospf 101
R3(config-router)# maximum-paths 2
R3(config-router)# network 10.2.0.0 0.0.0.3 area 0
R3(config-router)# network 10.3.0.0 0.0.0.3 area 0
R3(config-router)# network 10.5.0.0 0.0.0.3 area 0
R4(config)#router ospf 101
R4(config-router)#maximum-paths 2
R4(config-router)#network 10.1.0.0 0.0.0.3 area 0
R4(config-router)#network 10.4.0.0 0.0.0.3 area 0
R4(config-router)#network 10.5.0.0 0.0.0.3 area 0

Verify the configuration

Now that the configuration is finished lets verify our neighbors and routes. Using the show ip ospf neighborsshow ip route, and show ip cef commands you can verify the remote routes to which your router has formed and adjacency and verify the expected routes are being advertised. Use the ping command to verify connectivity.

As per the routing table we can confirm there are multiple redundant routes to 10.5.0.0 and 10.6.0.0 from R1. Using the show ip route 10.6.0.2 and show ip cef 10.6.0.2 we can further verify the routes are feasible. For equal cost load balancing to occur load must be observed on the line and at least two routes with the same metric, hop count, etc must be installed into the routing table.

Related Posts

Cisco Networking

BGP Load Sharing

What is load sharing and why to use it? Load balancing with BGP is not possible in a multihomed environment with two ISPs. BGP selects only the single best path to a destination among the Read more…

Application Containers

Docker container management using Rancher

What is container management and why to use it? A container management platform is a solution used to o create cloud-native, distributed applications and package legacy applications that were not originally designed for virtual environments. Read more…

Cisco Firewall

Configuring Dynamic Multipoint VPN and Zone Based Firewall

What is a Dynamic Multipoint VPN and why to use it? DMVPN provides the capability for creating a dynamic-mesh VPN network without having to pre-configure (static) all possible tunnel end-point peers, including IPsec (Internet Protocol Read more…