OcNOS-SP : Layer 3 Guide : Layer 3 Unicast Configuration Guide : Forwarding Plane Load Balancing
Forwarding Plane Load Balancing
OcNOS uses Forwarding Plane Load Balancing when the kernel supports Equal Cost Multipath (ECMP). OcNOS installs the maximum number of ECMP routes supported by the kernel. This allows for load balancing to be performed with more than one nexthop to reach a destination. If the router receives and installs multiple paths with the same administrative distance and cost to a destination, load-balancing is possible.
Ideally, multiple nexthops have different interfaces to the destination, but this is not mandatory. The algorithm for distributing traffic across ECMP routes is dependent on the kernel, and typically based on the protocol, source address, destination address, and port.
Enable Load Balancing
The following example illustrates how to enable Equal Cost Multipath (ECMP), and configure a routing protocol (OSPF is used in this example) for load balancing. However, this example will not work if the kernel does not support load balancing. In this topology, R1, R2, and R3 are three Linux routers connected to each other. R1 can reach R3 through two links available to R2.
Topology
Load Balancing Topology
Configuration
R1 - NSM
1. Enable multipath support and set the maximum number of paths to be installed in the Forwarding Information Base (FIB):
 
#configure terminal
Enter configure mode
(config)#maximum-paths 2
Create maximum paths 2
(config)#commit
Commit the candidate configuration to the running configuration
(config)#exit
Exit interface mode
 
Note: User can save and reboot to bring changes into effect.
R1 - OSPF
1. Configure OSPF on all interfaces on R1, R2, and R3.
R1 learns about R3 through 2 nexthops (both networks N1 and N2).
 
#configure terminal
Enter configure mode
(config)#router ospf 1
Enter ospf router mode
(config-router)#router 1.1.1.1
Specify router id
(config-router)#net 10.11.1.1/30 a 0
Configure ospf network in area 0
(config)#commit
Commit the candidate configuration to the running configuration
(config)#end
Exit interface mode
R2 - OSPF
 
#configure terminal
Enter configure mode
(config)#router ospf 1
Enter ospf router mode
(config-router)#router 2.2.2.2
Specify router id
(config-router)#net 10.11.1.2/30 a 0
Configure ospf network in area 0
(config)#commit
Commit the candidate configuration to the running configuration
(config)#end
Exit interface mode
R3 - OSPF
 
#configure terminal
Enter configure mode
(config)#router ospf 1
Enter ospf router mode
(config-router)#router 3.3.3.3
Specify router id
(config-router)#net 10.1.1.2/30 a 0
Configure ospf network in area 0
(config)#commit
Commit the candidate configuration to the running configuration
(config)#end
Exit interface mode
Validation
R1 - OSPF
Run the show ip ospf route command on R1. The OSPF routing table displays that it can reach R3 through both of the nexthops:
R1#show ip ospf route
OSPF process 100:
Codes: C - connected, D - Discard, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
 
C 10.10.10.0/24 [10] is directly connected, eth1, Area 0.0.0.0
C 10.10.11.0/24 [10] is directly connected, eth2, Area 0.0.0.0
O 20.10.10.0/24 [11] via 10.10.10.3, eth1, Area 0.0.0.0
via 10.10.11.3, eth2, Area 0.0.0.0
Run the show ip route command on R1. It displays that R1 has installed both nexthops to reach R3 in the NSM routing table:
R1#show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "default"
C 10.10.10.0/24 is directly connected, eth1, 00:17:08
C 10.10.11.0/24 is directly connected, eth2, 00:16:49
O 20.10.10.0/24 [110/11] via 10.10.11.3, eth2, 00:08:52
[110/11] via 10.10.10.3, eth1
C 127.0.0.0/8 is directly connected, lo, 00:25:21
C 192.168.52.0/24 is directly connected, eth0, 00:25:16
 
Gateway of last resort is not set