събота, юли 01, 2017

Debian bonding/teaming (LACP)

Understanding the Bond Modes

Bond Mode 0 – Balance-rr
This method of NIC teaming is called ‘Round-Robin‘, hence the ‘RR‘ in the name. With this bond method, networks packets are rotated through each of the network interface cards that make up the bonded interface.
For example, a system with eth0, eth1, and eth2 all slaved to a bond0 interface. This interface, when enabled with bond mode 0, would send the first packet out eth0, the second packet out eth1, the third packet our eth2, and then start back at eth0 with the fourth packet. This is where the mode gets its ‘round-robin‘ name.

Bond Mode 1 – Active-Backup
With this bond method, only one network interface is active while the other interfaces in the bond simply wait for a failure in the link to the primary network interface card.

Bond Mode 2 – Balance XOR
In a balance XOR bond mode the bond will evaluate the source and destination mac addresses to determine which interface to send the network packets out. This method will pick the same interface for a given mac address and as a result is capable of load balancing and fault tolerance.

Bond Mode 3 – Broadcast
In this method the bond device will transmit data out all slave interfaces hence the ‘broadcast‘ name of this particular bonding method. There are very few uses for this method but it does provide a level of fault tolerance.

Bond Mode 4 – 802.3ad
This is a special bond method for link aggregation and does require special configuration on the switch to which this particular bonded interface connects. This method follows the IEEE standards for link aggregation and provides both fault tolerance and increased bandwidth.

Bond Mode 5 – Transmit Load Balancing
In TLB the bond will receive traffic on the slave interfaces as normal but when the system needs to send traffic, it will determine which interface is the best to transmit data on based upon the load/queue for each of the interfaces.

Bond Mode 6 – Adaptive Load Balancing
In ALB the bond will load balance similar to Bond Mode 5 but with the added ability to load receive balance as well.



Debian setup:


apt-get install ifenslave

cat /etc/network/interfaces 

auto bond0
iface bond0 inet static
address 10.0.0.80
gateway 10.0.0.1
broadcast 10.0.0.255
netmask 255.255.255.0
up /sbin/ifenslave bond0 eth1 eth2
down /sbin/ifenslave -d bond0 eth0 eth1

OR: 

cat /etc/network/interfaces 

auto eth0
    iface eth0 inet manual
    bond-master bond0

auto eth1
     iface eth1 inet manual
     bond-master bond0

auto bond0
     iface bond0 inet static
     address 10.0.0.80
     gateway 10.0.0.1
     netmask 255.255.255.0


bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate 4
bond-slaves none

Cisco setup:

interface Port-channel2
 description LACP Channel for mk2
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,2
 switchport mode trunk
 spanning-tree portfast trunk
!
interface GigabitEthernet1/0/23
 description mk2 eth0
 switchport trunk encapsulation dot1q
 switchport mode trunk
 channel-group 2 mode active
!
interface GigabitEthernet1/0/24
 description mk2 eth1
 switchport trunk encapsulation dot1q
 switchport mode trunk
 channel-group 2 mode active

Checking the Status of the bonded LACP interface

$ cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.1.1 (September 26, 2006)

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

802.3ad info
LACP rate: fast
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 17
Partner Key: 1
Partner Mac Address: 00:77:66:55:44:33

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:99:98:97:96:95
Aggregator ID: 1

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:88:87:86:85:84
Aggregator ID: 1

Няма коментари: