首页 程序猿 码农开发 浏览内容
bonding
Bonding Mode
○ balance-rr or 0 — Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.
○ active-backup or 1 — Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
○ balance-xor or 2 — Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
○ broadcast or 3 — Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
○ 802.3ad or 4 — Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.
○ balance-tlb or 5 — Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.
○ balance-alb or 6 — Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.
Configuration
我选择的bonding模式是0(balance-round-robin),需要交换机支持Trucking功能,需要在交换机上将链路聚合功能打开。建议用模式6(balance-round-robin),不需要配置交换机。配置基本步骤如下:
yum install iputils
新建/etc/modprobe.d/bonding.conf添加:
alias bond0 bondingmodeprobe bonding
新建/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0TYPE=EthernetONBOOT=yesBOOTPROTO=noneIPADDR=xxxNETMASK=xxxGATEWAY=xxxDNS1=8.8.8.8USERCTL=noNM_CONTROLLED=no
BONDING_OPTS="mode=0 miimon=100"
修改/etc/sysconfig/network-scripts/ifcfg-eth0为:
DEVICE=eth0TYPE=EthernetBOOTPROTO=noneONBOOT=yesUSERCTL=noNM_CONTROLLED=no
MASTER=bond0SLAVE=yes
修改/etc/sysconfig/network-scripts/ifcfg-eth1为:
DEVICE=eth1TYPE=EthernetBOOTPROTO=noneONBOOT=yesUSERCTL=noNM_CONTROLLED=no
MASTER=bond0SLAVE=yes
Configuration Verification
cat /sys/class/net/bonding_masters/sys/class/net/bond0/*cat /proc/net/bonding/bond0/sys/class/net/bond0 (Virtual Subsystem)