3

Can someone provide me an example of how Equal-cost multi-path routing uses hashing to decided which packet goes to which? I apologize for that but all I found online are just a definition of ECMP.

2

ECMP takes place when multiple output (equal-cost) paths are available for forwarding packets to the same network destination.

The hash function must map information from the incoming packet to the output interface.

For example, let me make up an illustrative overly simple hashing function for this:

1) Picture every output interface with an ifIndex like this:

  • Fa0: ifIndex 1
  • Fa1: ifIndex 2
  • Fa2: ifIndex 3

Number of interfaces: 3

2) Given the destination IP address A.B.C.D, take the least significant byte D.

Example: IP = 1.0.0.5, D = 5

3) Divide the value of D by the number of interfaces, take the remainder, then and add one to it.

D = 5
Number of interfaces = 3
Remainder plus 1: 5 % 3 + 1 = 3

4) Use the result as ifIndex and throw the packet at its interface.

Example: For IP 1.0.0.5, write the packet to output interface Fa2 (ifIndex=3).

1

The load balancing can be configures (on Cisco devices) to be per packet or per destination.

Quote from How Does Load Balancing Work ?

For process-switching—load balancing is on a per-packet basis

For fast-switching—load balancing is on a per-destination basis

More detailed, in the same article:

 Per-Destination and Per-Packet Load Balancing

You can set load-balancing to work per-destination or per-packet. Per-destination load balancing means the router distributes the packets based on the destination address. Given two paths to the same network, all packets for destination1 on that network go over the first path, all packets for destination2 on that network go over the second path, and so on. This preserves packet order, with potential unequal usage of the links. If one host receives the majority of the traffic all packets use one link, which leaves bandwidth on other links unused. A larger number of destination addresses leads to more equally used links. To achieve more equally used links use IOS software to build a route-cache entry for every destination address, instead of every destination network, as is the case when only a single path exists. Therefore 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 thousands of destination hosts, memory and processing requirements for maintaining the cache become very demanding.

Per-packet load-balancing means that the router sends one packet for destination1 over the first path, the second packet for (the same) destination1 over the second path, and so on. Per-packet load balancing guarantees equal load across all links. However, there is potential that the packets may arrive out of order at the destination because differential delay may exist within the network. In Cisco IOS software, except the release 11.1CC, per packet load balancing does disable the forwarding acceleration by a route cache, because the route cache information includes the outgoing interface. 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.

Per-destination or per-packet load-balancing depends on the type of switching scheme used for IP packets. By default, on most Cisco routers, fast switching is enabled under interfaces. This is a demand caching scheme that does per-destination load-balancing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.