1.1.b [ii] Load balancing Hash

Ref:  http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipswitch_cef/configuration/15-mt/isw-cef-15-mt-book/isw-cef-load-balancing.html

CEF Load-Balancing 
Cisco Express Forwarding load balancing is based on a combination of source and destination packet information; it allows you to optimize resources by distributing traffic over multiple paths.
You can configure load balancing on a per-destination or per-packet basis. Because load-balancing decisions are made on the outbound interface, load balancing must be configured on the outbound interface.

The command for doing this is : ip load-share ‘per-destination or per-packet’

In per-destination mode all packets for a given destination are forwarded along the same path. This preserves packet order, with potential unequal usage of the links. If one host receives the majority of the traffic all packets will use one link, leaving bandwidth on other links unused.In IOS software this is achieved by building a route-cache entry for every destination address, instead of every destination network as done when only a single path exist. Therefor traffic for different hosts on the same destination network can use different paths. The downside of this approach is that for core backbone routers carrying traffic for 10000s of destination hosts memory and processing requirements for maintaining the cache become very demanding.

Per-packet load balancing guarantees equal load across all links, however potentially the packets may arrive out-of-order at the destination as differential delay may exist within the network.For per-packet load balancing the forwarding process determines the outgoing interface for each packet by looking up the route table and picking the least used interface. This ensures equal utilization of the links, but is a processor intensive task and impacts the overall forwarding performance. This form of per-packet load balancing is not well suited for higher speed interfaces.

 

Now i will try to explain the how the Hash per destinations work because i have spent many hours and still not sure 100% how to explain it so if ever you have a better and Simple explication please share.

In between the FIB and Adjacency table ,the load share table has a maximum of 16 pointers to entries in the adjacency table and will populate it by calculating like this :
You take the maximum Load Share ( 16 ) and you divided it by the number of equal destination possible.

So when the packet arrive the router does a routing hashing calcul with the source and destination address field and and create an index into the loadshare to the possible path toward the destination.

Example #1
With 2 equal destination you take the maximum of loadshare ( 16 ) and you divided by the number of equal path destination ( 2 )
So if you have 2 equal destination = 2 exit points then 8 Load Shares  :

Hash 1 = Interface exit 1
Hash 2 = Interface exit 2
Hash 3 = Interface exit 1
Hash 4 = Interface exit 2
Hash 5 = Interface exit 1
Hash 6 = Interface exit 2
Hash 7 = Interface exit 1
Hash 8 = Interface exit 2
Hash 9 = Interface exit 1
Hash 10 = Interface exit 2
Hash 11 = Interface exit 1
Hash 12 = Interface exit 2
Hash 13= Interface exit 1
Hash 14 = Interface exit 2
Hash 15= Interface exit 1
Hash 16 = Interface exit 2

Example #2
With 3 equal destination you take the maximum of loadshare ( 16 ) and you divided by the number of equal path destination ( 3 )
So if you have 3 equal destination = 3 exit points then 5 Load Shares  :

Hash 1 = Interface exit 1
Hash 2 = Interface exit 2
Hash 3 = Interface exit 3
Hash 4 = Interface exit 1
Hash 5 = Interface exit 2
Hash 6 = Interface exit 3
Hash 7 = Interface exit 1
Hash 8 = Interface exit 2
Hash 9 = Interface exit 3
Hash 10 = Interface exit 1
Hash 11 = Interface exit 2
Hash 12 = Interface exit 3
Hash 13= Interface exit 1
Hash 14 = Interface exit 2
Hash 15= Interface exit 3
Hash 16 = NOT USE

Example #3
With 4 equal destination you take the maximum of loadshare ( 16 ) and you divided by the number of equal path destination ( 4 )
So if you have 4 equal destination = 2 exit points then 4 Load Shares :

Hash 1 = Interface exit 1
Hash 2 = Interface exit 2
Hash 3 = Interface exit 3
Hash 4 = Interface exit 4
Hash 5 = Interface exit 1
Hash 6 = Interface exit 2
Hash 7 = Interface exit 3
Hash 8 = Interface exit 4
Hash 9 = Interface exit 1
Hash 10 = Interface exit 2
Hash 11 = Interface exit 3
Hash 12 = Interface exit 4
Hash 13 = Interface exit 1
Hash 14 = Interface exit 2
Hash 15 = Interface exit 3
Hash 16 = Interface exit 4

 

From this lab by using the command show ip cef (prefix) internal we can see the hashing table :

cefhash

R1#sh ip route 172.16.0.0
Routing entry for 172.16.0.0/32, 1 known subnets
O 172.16.0.1   [110/21] via 192.168.70.6, 00:24:09, Ethernet0/3
                       [110/21] via 192.168.30.4, 00:25:56, Ethernet0/2
                      [110/21] via 192.168.20.3, 00:25:46, Ethernet0/1
                     [110/21] via 192.168.10.2, 00:25:46, Ethernet0/0

R1#sh ip cef 172.16.0.1 internal
172.16.0.1/32, epoch 0, RIB[I], refcount 5, per-destination sharing
sources: RIB
feature space:
IPRM: 0x00028000
ifnums:
Ethernet0/0(3): 192.168.10.2
Ethernet0/1(4): 192.168.20.3
Ethernet0/2(5): 192.168.30.4
Ethernet0/3(6): 192.168.70.6
path F49DC240, path list F49FCE74, share 1/1, type attached nexthop, for IPv4
nexthop 192.168.10.2 Ethernet0/0, adjacency IP adj out of Ethernet0/0, addr 192.168.10.2 F1D43088
path F49DC2B0, path list F49FCE74, share 1/1, type attached nexthop, for IPv4
nexthop 192.168.20.3 Ethernet0/1, adjacency IP adj out of Ethernet0/1, addr 192.168.20.3 F1D431B8
path F49DC320, path list F49FCE74, share 1/1, type attached nexthop, for IPv4
nexthop 192.168.30.4 Ethernet0/2, adjacency IP adj out of Ethernet0/2, addr 192.168.30.4 F2640AF0
path F49DC0F0, path list F49FCE74, share 1/1, type attached nexthop, for IPv4
nexthop 192.168.70.6 Ethernet0/3, adjacency IP adj out of Ethernet0/3, addr 192.168.70.6 F2640C20
output chain:
loadinfo F1D445D0, per-session, 4 choices, flags 0003, 5 locks
flags: Per-session, for-rx-IPv4
16 hash buckets
< 0 > IP adj out of Ethernet0/0, addr 192.168.10.2 F1D43088
< 1 > IP adj out of Ethernet0/1, addr 192.168.20.3 F1D431B8
< 2 > IP adj out of Ethernet0/2, addr 192.168.30.4 F2640AF0
< 3 > IP adj out of Ethernet0/3, addr 192.168.70.6 F2640C20
< 4 > IP adj out of Ethernet0/0, addr 192.168.10.2 F1D43088
< 5 > IP adj out of Ethernet0/1, addr 192.168.20.3 F1D431B8
< 6 > IP adj out of Ethernet0/2, addr 192.168.30.4 F2640AF0
< 7 > IP adj out of Ethernet0/3, addr 192.168.70.6 F2640C20
< 8 > IP adj out of Ethernet0/0, addr 192.168.10.2 F1D43088
< 9 > IP adj out of Ethernet0/1, addr 192.168.20.3 F1D431B8
<10 > IP adj out of Ethernet0/2, addr 192.168.30.4 F2640AF0
<11 > IP adj out of Ethernet0/3, addr 192.168.70.6 F2640C20
<12 > IP adj out of Ethernet0/0, addr 192.168.10.2 F1D43088
<13 > IP adj out of Ethernet0/1, addr 192.168.20.3 F1D431B8
<14 > IP adj out of Ethernet0/2, addr 192.168.30.4 F2640AF0
<15 > IP adj out of Ethernet0/3, addr 192.168.70.6 F2640C20
Subblocks:
None

As for unequal cost more to come tomorrow ….. my head is going to blow up 😉

Leave a Comment