Wednesday, February 19, 2020

Etherchannel on Cisco IOS Catalyst Switch

In this tutorial we‟ll take a look at etherchannel which is also known as link aggregation. Etherchannel is a technology that lets you bundle multiple physical links into a single logical link. We”ll take a look at how it works and what the advantages of etherchannel are. Let’s start with an example of a small network:
sw1 sw2 two hosts gigabit fastethernet
Take a look at the picture above. I have two switches and two computers connected to the switches. The computers are connected with 1000 Mbit interfaces while the link between the
switches is only 100 Mbit. If one of the computers would send traffic that exceeds 100 Mbit of bandwidth we”ll have congestion and traffic will be dropped.
There are two solutions to this problem:
  • Replace the link in between the switches with something that has a higher bandwidth, perhaps a gigabit or 10gigabit link.
  • Add multiple links and bundle them into an etherchannel.
Since this tutorial is about Etherchannel, we’ll take a look at adding multiple links. Here’s an example:

sw1 sw2 two hosts 4 fastethernet links
In the picture above I have added a couple of extra links. The problem with this setup is that we have a loop so spanning tree would block 3 out of 4 links. Etherchannel solves this problem because it will create a single virtual link out of these physical links:
sw1 sw2 two hosts etherchannel 400 mbit
By combining 4x 100 Mbit I now have a 400 Mbit link. Spanning tree sees this link as one logical link so there are no loops! Etherchannel will do load balancing among the different links that we have and it takes care of redundancy. Once one of the links fails it will keep working and use the links that we have left.
There’s a maximum to the number of links you can use: 8 physical interfaces.
If you want to configure an Etherchannel there are two protocols you can choose from:
  • PAgP (Cisco proprietary)
  • LACP (IEEE standard)
These protocols can dynamically configure an etherchannel. It‟s also possible to configure a static etherchannel without these protocols doing the negotiation of the link for you. If you are going to create an etherchannel you need to make sure that all ports have the same configuration:
  • Duplex has to be the same.
  • Speed has to be there same.
  • Same native AND allowed VLANs.
  • Same switchport mode (access or trunk).
PAgp and LACP will check if the configuration of the interfaces that you use are the same.
If you want to configure PAgP there are a number of options you can choose from, the interface can be configured as:
  • On (interface becomes member of the etherchannel but does not negotiate).
  • Desirable (interface will actively ask the other side to become an etherchannel).
  • Auto (interface will wait passively for the other side to ask to become an etherchannel).
  • Off (no etherchannel configured on the interface).
Let me show you an example how to configure PAgP between two switches. I’ll use SW1 and SW2 for this demonstration:
    sw1 sw2 fa013 fa014
SW1 and SW2 each have a FastEthernet 0/13 and 0/14 interface. We’ll bundle these into a single logical link.
SW1(config)#interface fa0/13
SW1(config-if)#channel-group 1 mode ?
  active     Enable LACP unconditionally
  auto       Enable PAgP only if a PAgP device is detected
  desirable  Enable PAgP unconditionally
  on         Enable Etherchannel only
  passive    Enable LACP only if a LACP device is detected
First we go to the interface level where we can create a channel-group. I’m going to use channel-group number 1. Above you can see the different options that we have for PAgP and LACP.
SW1(config)#interface fa0/13
SW1(config-if)#channel-group 1 mode desirable 
Creating a port-channel interface Port-channel 1
SW1(config)#interface fa0/14
SW1(config-if)#channel-group 1 mode desirable
I configure SW1 for PAgP desirable mode. It will actively ask SW2 to become an Etherchannel this way.
SW2(config)#interface fa0/13
SW2(config-if)#channel-group 1 mode auto 
SW2(config)#interface fa0/14
SW2(config-if)#channel-group 1 mode auto
Here’s the configuration of SW2. I used the PAgP auto mode so it will respond to requests to become an etherchannel.
SW1 %LINK-3-UPDOWN: Interface Port-channel1, changed state to up
SW2 %LINK-3-UPDOWN: Interface Port-channel1, changed state to up
You’ll see a message on your switches like mine above. The switch will create a port-
channel interface.
SW1(config)#interface port-channel 1
SW1(config-if)#switchport trunk encapsulation dot1q 
SW1(config-if)#switchport mode trunk
SW2(config)#interface port-channel 1
SW2(config-if)#switchport trunk encapsulation dot1q 
SW2(config-if)#switchport mode trunk
The port-channel interface can be configured. I’ve set mine to use 802.1Q encapsulation and to become a trunk.
SW1#show etherchannel 1 port-channel 
  Port-channels in the group: 
  ---------------------------

Port-channel: Po1
------------

Age of the Port-channel   = 0d:00h:10m:16s
Logical slot/port   = 2/1          Number of ports = 2
GC                  = 0x00010001      HotStandBy port = null
Port state          = Port-channel Ag-Inuse 
Protocol            =   PAgP
Port security       = Disabled

Ports in the Port-channel: 

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
  0     00     Fa0/13   Desirable-Sl       0
  0     00     Fa0/14   Desirable-Sl       0

Time since last port bundled:    0d:00h:00m:07s    Fa0/14
Time since last port Un-bundled: 0d:00h:04m:08s    Fa0/13
Here’s one way to verify your configuration. Use the show etherchannel port-channel command to check if the port-channel is active or not. You can also see that we are using PAgP. Interface fa0/13 and fa0/14 are both in use for this etherchannel.
SW1#show etherchannel summary 
Flags:  D - down        P - bundled in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      f - failed to allocate aggregator

        M - not in use, minimum links not met
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
1      Po1(SU)         PAgP      Fa0/13(P)   Fa0/14(P)
If you have many etherchannels you can also use the show etherchannel summary command. It will give you a quick overview of all the etherchannels and the interfaces that are in use.
SW1#show interfaces fa0/14 etherchannel 
Port state    = Up Mstr In-Bndl 
Channel group = 1           Mode = Desirable-Sl    Gcchange = 0
Port-channel  = Po1         GC   = 0x00010001      Pseudo port-channel = Po1
Port index    = 0           Load = 0x00            Protocol =   PAgP

Flags:  S - Device is sending Slow hello.  C - Device is in Consistent state.
        A - Device is in Auto mode.        P - Device learns on physical port.
        d - PAgP is down.
Timers: H - Hello timer is running.        Q - Quit timer is running.
        S - Switching timer is running.    I - Interface timer is running.

Local information:
                                Hello    Partner  PAgP     Learning  Group
Port      Flags State   Timers  Interval Count   Priority   Method  Ifindex
Fa0/14    SC U6/S7   H 30s  1        128        Any      5001

Partner's information:

          Partner              Partner          Partner         Partner Group
Port      Name                 Device ID        Port       Age  Flags   Cap.
Fa0/14    SW2              0019.569d.5700 Fa0/14      19s SAC 10001 

Age of the port in the current state: 0d:00h:02m:37s
The third method to verify your etherchannel is to use the show interfaces etherchannel command. In my example I am looking at the information of my fa0/14 interface. Besides information of our local switch you can also see the interface of our neighbor switch (SW2 in my example).
The last thing I want to share with you about PAgP are the different modes you can choose from:
  • On
  • Desirable
  • Auto
  • Off
I have configured SW1 to use desirable and SW2 to use auto mode. Not all the different combinations work:
OnDesirableAutoOff
OnYesNoNoNo
DesirableNoYesYesNo
AutoNoYesNoNo
OffNoNoNoNo
Here’s an overview with all the different options. Keep in mind that configuring your etherchannel as “on” doesn’t use any negotiation so it will fail if the other side is configured for auto or desirable.
hostname SW1
!
interface FastEthernet0/13
 channel-group 1 mode desirable 
!
interface FastEthernet0/14
 channel-group 1 mode desirable 
!
interface port-channel 1
 switchport trunk encapsulation dot1q 
 switchport mode trunk
!
end
hostname SW2
!
interface FastEthernet0/13
 channel-group 1 mode auto 
!
interface FastEthernet0/14
 channel-group 1 mode auto
!
interface port-channel 1
 switchport trunk encapsulation dot1q 
 switchport mode trunk
!
end
LACP is similar to PAgP. You also have different options to choose from when you configure the interface:
  • On (interfaces becomes member of the etherchannel but does not negotiate).
  • Active (interface will actively ask the other side to become an etherchannel).
  • Passive (interface will wait passively for the other side to ask to become an etherchannel).
  • Off (no etherchannel configured on the interface).
It’s basically the same thing as PAgP but the terminology is different. Let’s configure LACP to see what it does.
SW1(config)#default interface fa0/13
Interface FastEthernet0/13 set to default configuration
SW1(config)#default interface fa0/14
Interface FastEthernet0/14 set to default configuration
SW2(config)#default interface fa0/13
Interface FastEthernet0/13 set to default configuration
SW2(config)#default interface fa0/14
Interface FastEthernet0/14 set to default configuration
SW1(config)#no interface port-channel1
SW2(config)#no interface port-channel1
Don’t forget to clean up PAgP before you start playing with LACP.
SW1(config-if)#interface fa0/13
SW1(config-if)#channel-group 1 mode active 
Creating a port-channel interface Port-channel 1
SW1(config-if)#interface f0/14
SW1(config-if)#channel-group 1 mode active
I’ll configure SW1 to use LACP active mode.
SW2(config)#interface fa0/13
SW2(config-if)#channel-group 1 mode passive 
Creating a port-channel interface Port-channel 1
SW2(config-if)#interface fa0/14
SW2(config-if)#channel-group 1 mode passive
SW2 will use LACP passive mode.
SW1#show  etherchannel 1 port-channel 
  Port-channels in the group: 
  ---------------------------

Port-channel: Po1    (Primary Aggregator)

------------

Age of the Port-channel   = 0d:00h:03m:04s
Logical slot/port   = 2/1          Number of ports = 2
HotStandBy port = null 
Port state          = Port-channel Ag-Inuse 
Protocol            =   LACP
Port security       = Disabled

Ports in the Port-channel: 

Index   Load   Port     EC state        No of bits
------+------+------+------------------+-----------
  0     00     Fa0/13   Active             0
  0     00     Fa0/14   Active             0

Time since last port bundled:    0d:00h:00m:54s    Fa0/14
We can use the show etherchannel port-channel command again to verify our configuration again. As you can see the protocol is now LACP and interfaces fa0/13 and fa0/14 are active.
The configuration of PAgP and LACP is similar. Keep in mind that PAgP can only be used between Cisco devices while LACP is a IEEE standard, you can use it to form etherchannels with devices from other vendors.
OnActivePassiveOff
OnYesNoNoNo
ActiveNoYesYesNo
PassiveNoYesNoNo
OffNoNoNoNo
Here’s an overview with the different modes and combinations for LACP. It’s similar to PAgP but now we have the active and passive mode.
Last thing I want to show you about etherchannel is load-balancing:
SW1#show etherchannel load-balance 
EtherChannel Load-Balancing Configuration:
        src-mac

EtherChannel Load-Balancing Addresses Used Per-Protocol:
Non-IP: Source MAC address
  IPv4: Source MAC address
  IPv6: Source MAC address
Use the show etherchannel load-balance command to see what the default configuration is. As you can see our etherchannel load-balances based on the source MAC address.
SW1(config)#port-channel load-balance ?
  dst-ip       Dst IP Addr
  dst-mac      Dst Mac Addr
  src-dst-ip   Src XOR Dst IP Addr
  src-dst-mac  Src XOR Dst Mac Addr
  src-ip       Src IP Addr
  src-mac      Src Mac Addr
You can use the global port-channel load-balance command to change this behavior. You can see you can choose between source/destination MAC/IP address or a combination of source/destination.
Why should you care about load balancing? Take a look at the picture below:
cisco etherchannel load balance scenario
On the left side, we have SW1 and four computers. On the right side, we have SW2 and a router. The default load-balancing mechanism is source MAC address. This means that ALL traffic from one MAC address will be sent down one and the same physical interface, for example:
  • MAC address AAA will be sent using SW1’s fa0/13 interface.
  • MAC address BBB will be sent using SW1’s fa0/14 interface.
  • MAC address CCC will be sent using SW1’s fa0/13 interface.
  • MAC address DDD will be sent using SW1’s fa0/14 interface.
Since we have multiple computers this is fine, both physical links on SW1 will be used for our etherchannel so depending on how much traffic the computers send it will be close to a 1:1 ratio.
It’s a different story for SW2 since we only have one router with MAC address EEE. It will pick one of the physical interfaces so ALL traffic from the router will be sent down interface fa0/13 OR fa0/14. One of the physical links won’t be used at all…
SW2(config)#port-channel load-balance dst-mac
If this is the case it’s better to change the load balancing mechanism. If we switch it to destination MAC address on SW2 traffic from our router to the computer will be load-balanced amongst the different physical interfaces because we have multiple computers with different destination MAC addresses.
hostname SW1
!
interface FastEthernet0/13
 channel-group 1 mode active 
!
interface FastEthernet0/14
 channel-group 1 mode active
!
interface port-channel 1
 switchport trunk encapsulation dot1q 
 switchport mode trunk
!
end
hostname SW2
!
interface FastEthernet0/13
 channel-group 1 mode passive
!
interface FastEthernet0/14
 channel-group 1 mode passive
!
interface port-channel 1
 switchport trunk encapsulation dot1q 
 switchport mode trunk
!
port-channel load-balance dst-mac
!
end

That’s all I have on Etherchannels for now, hopefully this has been helpful to you! If you have any questions feel free to leave a comment.

No comments:

Post a Comment