====== Channel Bonding en mode 802.3ad (redondance de lien + équilibrage de charge) ====== On utilise pour ça le mode //802.3ad//. **Installation de ifenslave : ** apt-get install ifenslave-2.6 **Fichier /etc/network/interfaces : ** auto bond0 iface bond0 inet static slaves eth0 eth1 bond-mode 802.3ad bond-miimon 100 bond-downdelay 200 bond-updelay 200 address 192.168.0.1 network 255.255.255.0 gateway 192.168.0.254 Il peut être nécessaire de forcer le mode de //bonding// au moment du chargement du module kernel (rencontré avec un switch Cisco notamment et le mode 802.3ad). Dans ce cas, éditer le fichier ///etc/modprobe.d/bonding.conf// et ajouter : options bonding mode=4 miimon=100 ===== Utilisation avec des VLANs ===== auto bond0 iface bond0 inet manual slaves eth0 eth1 bond-mode 802.3ad bond-miimon 100 bond-downdelay 200 bond-updelay 200 auto vlan1 iface vlan1 inet static vlan-raw-device bond0 address 192.168.0.1 network 255.255.255.0 gateway 192.168.0.254 auto vlan2 iface vlan2 inet static vlan-raw-device bond0 address 192.168.1.1 network 255.255.255.0 ===== Mode de bonding supporté par le kernel Linux ===== ^ Nom ^ ID ^ Description ^ | balance-rr | 0 | Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance. | | active-backup | 1 | Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode. | | balance-xor | 2 | XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance. | | broadcast | 3 | Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance. | | 802.3ad | 4 | IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification. **Pre-requisites : Ethtool support in the base drivers for retrieving the speed and duplex of each slave. The switch must supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.** | | balance-tlb | 5 | Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave. **Pré-requis : Ethtool support in the base drivers for retrieving the speed of each slave.** | | balance-alb | 6 | Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server. | ====== Procédures ====== ===== État détaillé d'un bond ===== ip -d -s -s link ls dev bond0 ===== Création manuelle d'un bond ===== # create the bonding interface with active-backup mode ip link add name bond0 type bond mode active-backup # add the under laying interfaces # the interface, that has been added first, will be active ip link set master bond0 dev eth1 ip link set master bond0 dev eth0 # enable the bonding interface ip link set up dev bond0 ip address add 192.168.100.1/24 dev bond0 # check the results: detailed info and statistics of bond0 ip -s -s -d link ls dev bond0 # check the state of ALL under laying interfaces # with statistics and details ip -s -s -d link ls master bond0 # check the kernel logs journalctl -kn 20 Source : https://serverfault.com/a/1064428 ===== Changer d'interface active ===== * Lister les interfaces : * cat /sys/devices/virtual/net/bond0/bonding/slaves * ou : ip link show master bond0 * Voir l'interface active : cat /sys/devices/virtual/net/bond0/bonding/primary * Changer d'interface active : * echo eth1 > /sys/devices/virtual/net/bond0/bonding/primary * ou : ip link set dev bond0 type bond active_slave eth1 ===== Supprimer/ajouter une interface slave à un bond ===== * Sortir ''eth0'' de son bond actuel : ''ip link set nomaster dev eth0'' * Mettre ''eth0'' dans ''bond0'' : ''ip link set master bond0 dev eth0''