Load balancing

One link of a bundle runs at 94% while three idle, and nothing is broken. An EtherChannel picks a link by reducing part of a frame's addresses to a number, so the method decides the spread. The default suits a switch with many workstations facing a single router. One command, port-channel load-balance, changes it for every channel; choose a field that takes many values.

In Daveth Pro (Network)5 min video · lab: Campus, hardened

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Load balancing

Watch this lesson

5 min · Video walkthrough

In Daveth Pro (Network)

The full 5 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab C1: Campus, hardened

What the lab covers

What this page answers

How does EtherChannel load balancing work?

It reduces part of the binary pattern formed from addresses in the frame to a number that selects one link, so all traffic with the same values takes the same link. The method sets which fields are read. Read it in “What picks the link”

Which EtherChannel load-balancing method should you use?

One based on a field that takes many values on that device, in that position. Toward a single router, destination MAC has one value and uses one link; source MAC from many workstations spreads. Read it in “Choosing by what varies”

What picks the link

Four links in a bundle, and one of them at 94% while the other three idle. Nothing is broken and no member is suspended. How does a bundle decide which link a frame takes?

EtherChannel balances the traffic load across the links in a channel by reducing part of the binary pattern that is formed from the addresses in the frame to a numerical value that selects one of the links in the channel. You can specify one of several different load-balancing modes, including load distribution based on MAC addresses, IP addresses, source addresses, destination addresses, or both source and destination addresses.

Read it as a function. Addresses go in, a number comes out, the number picks a link. Nothing in that sentence measures how busy a link is.

With source-MAC address forwarding, when packets are forwarded to an EtherChannel, they are distributed across the ports in the channel based on the source-MAC address of the incoming packet. Therefore, to provide load-balancing, packets from different hosts use different ports in the channel, but packets from the same host use the same port in the channel. Therefore, packets to the same destination are forwarded over the same port, and packets to a different destination are sent on a different port in the channel.

So the same value always lands on the same link. Whether a bundle spreads traffic depends on how many different values the chosen field takes in the traffic it carries.

So the switch is not being lazy. It is being consistent, which today is worse. It was asked to send the same addresses down the same link every single time, and that is precisely what it is doing, forty thousand frames an hour, with three perfectly good links watching. Nobody wrote a bug. Somebody chose a field.

Load distribution on the switch is based on the source-MAC address of the incoming packet.

The chapter's own example

SW-A has forty workstations behind it and a four-link EtherChannel to RTR-1. It runs the default. Does the router being a single MAC address hurt?

In the following figure, an EtherChannel of four workstations communicates with a router. Because the router is a single MAC-address device, source-based forwarding on the switch EtherChannel ensures that the switch uses all available bandwidth to the router.

Computed from the state: Po1 from SW-A toward RTR-1, default method. No command prints it.

channel         Po1 to RTR-1, 4 links
method          src-mac (on SW-A)
traffic         to the router, 40 flows
fields read     srcMac
distinct values 40
verdict         can spread
because         40 distinct values across 4 links; which link each selects is
                not published

Look at the distinct values row. Forty source MACs, because the sources are the workstations. The router being one address matters to a destination method, not to this one.

It is tempting to reason the opposite, and this course's first version did: the router is one MAC address, so the default must pile everything onto one link toward it. The chapter uses the default as its example of a method that uses all the bandwidth.

And the other direction, on RTR-1's side of the same bundle?

The router is configured for destination-based forwarding because the large number of workstations ensures that the traffic is evenly distributed from the router EtherChannel.

Computed from the state: Po1 from RTR-1 toward SW-A, destination-based. No command prints it.

channel         Po1 from RTR-1, 4 links
method          dst-mac (on RTR-1)
traffic         from the router, 40 flows
fields read     dstMac
distinct values 40
verdict         can spread
because         40 distinct values across 4 links; which link each selects is
                not published

The chapter configures the two ends differently, and each end forwards its own direction. How RTR-1 is configured is not in this chapter; the page models its method and draws no router command.

One command, every channel

Now someone changes SW-A to a destination-MAC method, reasoning that destination spreads well for the router. What does Po1 do?

Configuration: the change, in the form the chapter prints; the hostname is this course's own.

SW-A# configure terminal
SW-A(config)# port-channel load-balance dst-mac
SW-A(config)# end

Computed from the state: Po1 toward the router after the change. No command prints it.

channel         Po1 to RTR-1, 4 links
method          dst-mac (on SW-A)
traffic         to the router, 40 flows
fields read     dstMac
distinct values 1
verdict         one link
because         every frame has the same dstMac, so the same value selects the
                same link
Use the option that provides the greatest variety in your configuration. For example, if the traffic on a channel is going only to a single MAC address, using the destination-MAC address always chooses the same link in the channel. Using source addresses or IP addresses might result in better load-balancing.

One destination MAC, one link. The chapter gives this exact case, and its fix: source addresses or IP addresses.

Think about what we just asked the switch to hash on. There is one router. So the guest list for this calculation has exactly one name on it, and the calculation dutifully returns the same answer every time it is asked. Four links, one answer. The change was made to spread traffic and it removed the last of the variety the bundle had.

And SRV-1, whose bundle nobody was thinking about?

The selected mode applies to all EtherChannels configured on the device.

Computed from the state: Po2 to SRV-1 after the same change. No command prints it.

channel         Po2 to SRV-1, 2 links
method          dst-mac (on SW-A)
traffic         to the server, 40 flows
fields read     dstMac
distinct values 1
verdict         one link
because         every frame has the same dstMac, so the same value selects the
                same link

The configured line proves: which method SW-A uses, and so which fields it reads, on every EtherChannel it has. It does not prove: that those fields vary in the traffic any one channel carries, or which link a given value selects.

By this course's reading, RTR-1's own side fails the same way when it uses a source method, because every reply leaves with RTR-1's own MAC and the chapter says packets from the same host use the same port:

Computed from the state: Po1 from RTR-1, source-based. No command prints it.

channel         Po1 from RTR-1, 4 links
method          src-mac (on RTR-1)
traffic         from the router, 40 flows
fields read     srcMac
distinct values 1
verdict         one link
because         every frame has the same srcMac, so the same value selects the
                same link

Choosing by what varies

Different load-balancing methods have different advantages, and the choice of a particular load-balancing method should be based on the position of the device in the network and the kind of traffic that needs to be load-distributed.

So the choice is a question about traffic, not about the switch. Which field takes many values on this device, in this position?

With source-and-destination MAC-address forwarding, packets sent from host A to host B, host A to host C, and host C to host B could all use different ports in the channel. To provide load balancing, packets from different IP addresses use different ports in the channel, and packets from the same IP address use the same port in the channel. To provide load balancing, packets from the same IP source address that is sent to different IP destination addresses could be sent on different ports in the channel. Packets sent from different source IP addresses to the same destination IP address are always sent on the same port in the channel. In this method, packets sent from the IP address A to IP address B, from IP address A to IP address C, and from IP address C to IP address B could all use different ports in the channel.