Sign Up|Login Courses & Workshops
Overview
Pricing
CISCO REFERENCE HOME

Cisco Router Per-packet Load Balancing

Load balancing across multiple routes on a Cisco router

When multiple routes for the same destination network are installed in a router's Routing Table, a router can load-balance traffic across the different routes.

Cisco Routers offer 2 mechanisms to load-balance traffic across multiple routes with the same Administrative Distance. In this note we will discuss per-packet load balancing.

Consider the routing table below:

Router1 Console
Router1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, 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, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set
 
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C   10.0.0.0/24 is directly connected, GigabitEthernet0/1
L   10.0.0.1/32 is directly connected, GigabitEthernet0/1
C   10.0.2.0/24 is directly connected, GigabitEthernet0/0
L   10.0.2.1/32 is directly connected, GigabitEthernet0/0
S   10.20.0.0/24 [1/0] via 10.0.0.2
S   10.20.0.0/24 [1/0] via 10.0.0.3
S   10.20.0.0/24 [1/0] via 10.0.2.2
Router1#

There are 2 connected routes and 3 static routes installed in the routing table. All 3 static routes are for the destination network 10.20.0.0/24. When the router receives an IP packet addressed to 10.20.0.10 how does it decide where to forward that packet?

Per-packet load balancing

When a router is configured for per-packet load balancing, IP packets are distributed evenly across the available routes for a network on a per-packet basis.

In our example, the first time that the router has to route a packet to the destination network 10.20.0.0/24 the router chooses the first route available (10.0.0.2). The next packet that must be routed to the network 10.20.0.0/24 will be routed over the 2nd path (10.0.0.3). The third packet will be forwarded to 10.0.2.2.

When the next packet has to be routed to 10.20.0.0/24, the router will forward it to 10.0.0.2 and the round-robin process continues.

Configuring per-packet load balancing

Per-packet load balancing is not the default load-balancing mode on Cisco routers. Per-packet load balancing can be configured using the following command:

ip load-sharing per-packet

This command is an Interface Configuration Mode command. It must be applied to every interface that forwards traffic to the destination network that we are interested in. In our example, the 3 routes to the network 10.20.0.0/24 are reached via Interface gi0/1 (for 10.0.0.2 and 10.0.0.3) and Interface gi0/0 (for 10.0.2.2).

Per-packet load balancing must be configured on both interface gi0/1 and gi0/0 as shown below:

Router1 Console
Router1(config)#int gi0/1
Router1(config-if)#ip load-sharing per-packet
Router1(config-if)#int gi0/0
Router1(config-if)#ip load-sharing per-packet
Router1(config-if)#

Advantages of per-packet load balancing

The primary advantage of per-packet load balancing is that this mechanism guarantees the distribution of traffic equally across all the available links.

Disadvantages of per-packet load balancing

There are 2 main disadvantages of per-packet load balancing.

Out of order packets

The primary disadvantage of per-packet load balancing is that this mechanism cannot guarantee the arrival of packets in the order that they were sent from the source device. Since each packet from a specific source device to a specific destination device may take a different path to the destination device, the packets may arrive at the destination device in a different order than they were sent out.

Processor-intensive mechanism

Another disadvantage of per-packet load balancing is the fact that this is a processor-intensive mechanism and could result in lower overall performance on high-speed interfaces. This mechanism requires a routing table lookup for each packet in order to choose the least used path for a given destination network.


Route Installation and Route Selection on Cisco routers is covered extensively in Course 4 - Static Routes on this website.

Want to test your networking skills with hands-on configuration and troubleshooting questions? Try out the Workshops section of this website here: Workshops (Login required).

Read how to use the device simulators on this website here: Workshops - General Instructions