Vamos verificar nossas interfaces disponíveis
[root@centos7-x86-64 ~]# ip add show 4: enp0s9: mtu 1500 qdisc pfifo_fast state UP qlen 1000<br> link/ether 08:00:27:d9:e7:bd brd ff:ff:ff:ff:ff:ff<br> 5: enp0s10: mtu 1500 qdisc pfifo_fast state UP qlen 1000<br> link/ether 08:00:27:38:f9:41 brd ff:ff:ff:ff:ff:ff
Vamos configurar o módulo do kernel.
modprobe bonding mode=balance-alb miimon=100
Criar a Interface
ip addr add 192.168.100.1/24 dev bond0
Subir a interface.
ip link set bond0 up
Adicionar as interfaces .
ip link set enp0s9 master bond0 ip link set enp0s10 master bond0
[root@centos7-x86-64 ~]# ip add show 6: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN link/ether 6e:a9:56:b1:13:21 brd ff:ff:ff:ff:ff:ff inet 192.168.100.1/24 scope global bond0 valid_lft forever preferred_lft forever
Configurando de Forma Alternativa
echo balance-alb > /sys/class/net/bond0/bonding/mode ip addr add 192.168.100.1/24 dev bond0 ip link set bond0 up echo 100 > /sys/class/net/bond0/bonding/miimon echo +enp0s9 > /sys/class/net/bond0/bonding/slaves echo +enp0s9 > /sys/class/net/bond0/bonding/slaves
mode 0 / balance-rr – Round-robin policy: Transmit packets in sequential order from the first available slave through the,last.This mode provides load balancing and fault tolerance.
mode 1 / active-backup – 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.
mode 2 / balance-xor – XOR policy: Transmit based on the selected transmit,hash policy.,The default policy is a simple [(source MAC address XOR’d with destination MAC address XOR packet type ID) modulo slave count].,Alternate transmit policies may be,selected via the xmit_hash_policy option, described below. This mode provides load balancing and fault tolerance.
mode 3 / broadcast – Broadcast policy: transmits everything on all slave,interfaces.,This mode provides fault tolerance.
mode 4 / 802.3ad – 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.
mode 5 / balance-tlb – Adaptive transmit load balancing: channel bonding that,does not require any special switch support.In tlb_dynamic_lb=1 mode; the outgoing traffic is,distributed according to the current load (computed,relative to the speed)on each slave., In tlb_dynamic_lb=0 mode; the load balancing based on,current load is disabled and the load is distributed,only using the hash distribution.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.
mode 6 / balance-alb – 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.