2015-05-10

Testing out Link Aggregation


I picked up a TP-Link managed switch last week as something of a compromise between affordability and features - as it turns out though, it does just about everything I could ask for, just without the extra expense from buying something that has HP or Cisco written on the side.

I grabbed the TL-SG3216, a fanless L2 managed switch with 16x1Gigabit ports as it ticked all the boxes:
  • Silent (fanless)
  • Managed
  • Link Aggregation/802.3ad (LACP)
  • 802.1Q (VLAN)
  • STP

As a bonus, the CLI interface (via console cable or ssh) is very similar to Cisco's IOS, so I don't have to learn an entirely new syntax to configure it.

Before I replace my existing switch, I spent a bit of time testing out its features. First up, I setup a spare Raspberry Pi with a second ethernet interface (via a USB dongle) to test out link aggregation.



First up, the configuration on the Pi (Raspbian):

Install ifenslave to allow for the creation of bonded network interfaces

# apt-get install ifenslave


Remove lines for eth0, eth1 from `/etc/networking/interfaces` and replace with a bond0 entry that adds the two interfaces as slaves:
 

auto bond0
iface bond0 inet static
    address  192.168.1.10
    netmask  255.255.255.0
    gateway  192.168.1.123
    # jumbo frame support
    mtu 9000
    # bond settings
    bond_miimon  100
    bond_mode 4
    bond-downdelay 200
    bond-updelay 200
    slaves eth0 eth1


Note on bond modes:

  • mode 0 (load balancing [rr])
  • mode 4 (802.3ad)

Bring up the interface:

# ifup bond0
 

Check its status:

# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
    Aggregator ID: 1
    Number of ports: 1
    Actor Key: 4
    Partner Key: 1
    Partner Mac Address: 00:00:00:00:00:00

Slave Interface: eth0
MII Status: up
Speed: 10 Mbps
Duplex: half
Link Failure Count: 0
Permanent HW addr: b8:27:eb:95:0e:4d
Aggregator ID: 1
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 20:c9:d0:2c:93:9a
Aggregator ID: 2
Slave queue ID: 0



One strange thing from the above output is that it listed eth0 as running at 10Meg and half-duplex. However, checking both the switch and eth0 via ifconfig and dmesg shows the interface running at 100Meg/full - so I'm not sure why this discrepancy exists.


Examining each interface in turn shows the two physical adapters up and running in slave mode while the created bond0 interface is running as a master. Once bonded, all interfaces share a hardware address (that of the first interface):

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr b8:27:eb:95:0e:4d
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:5466 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4048 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7513825 (7.1 MiB)  TX bytes:358909 (350.4 KiB)

# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr b8:27:eb:95:0e:4d
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:68 errors:0 dropped:42 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7256 (7.0 KiB)  TX bytes:1408 (1.3 KiB)

# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr b8:27:eb:95:0e:4d
          inet addr:10.33.2.51  Bcast:10.33.7.255  Mask:255.255.248.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:320 errors:0 dropped:42 overruns:0 frame:0
          TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:30587 (29.8 KiB)  TX bytes:19586 (19.1 KiB)




Configuration on a TP-Link TL-SG3216 switch is as follows:


Add two ports to an etherchannel group and set the mode of the channel group to `active`:

 
switch01(config)#interface range gigabitEthernet 1/0/1-2

switch01(config-if-range)#channel-group 1 mode active

 

Show the etherchannel and LACP info to check the configuration is active:
 
switch01#show etherchannel
                Channel-group listing:
                ----------------------

Group: 1
----------
Group state = L2
Ports: 2  MaxPorts = 16
Protocol:   LACP


switch01#show lacp 1 int
Flags:  S - Device is requesting Slow LACPDUs
        F - Device is requesting Fast LACPDUs
        A - Device is in active mode       P - Device is in passive mode

Channel group 1
                            LACP port     Admin     Oper    Port        Port
Port      Flags   State     Priority      Key       Key     Number      State
Gi1/0/1   SA      Up        32768         0x1       0x783   0x1         0x7d
Gi1/0/2   SA      Up        32768         0x1       0x783   0x2         0x3d

No comments:

Post a Comment