Bind two network cards, share one IP, realize the redundancy effect. In fact, there are 7 types of bindings for Linux dual NICs:
- The mode=0 indicates that load balancing (round-robin) is balanced, and both NICs work.
- mode=1 says Fault-tolerance (active-backup) provides redundancy, working in a master-slave way, which means that only one NIC works by default, and the other is backed up.
- Mode=2 indicates that the XOR policy is a balanced strategy. This mode provides load balancing and fault tolerance
- Mode=3 indicates that broadcast is a broadcast policy. This mode provides fault tolerance
- Mode=4 represents the IEEE 802.3ad dynamic Link Aggregation for IEEE 802.3ad as a dynamically linked aggregation. This policy can be changed from the default XOR policy to other policies through the Xmit_hash_policy option.
- The mode=5 represents Adaptive transmit load balancing for the adapter transport balancing. Required for this pattern: Ethtool supports getting the rate per slave
- Mode=6 indicates that the Adaptive load balancing is an adaptive load balancer for the adapter. This mode includes the BALANCE-TLB mode, plus receive load balancing for IPV4 traffic (receive load balance, RLB), and does not require any switch (switch) support.
Installing the Load Software
apt-get install ifenslave
Loading modules and configuring loads
vi /etc/modules
Add to
bonding mode=0 miimon=100
Miimon is 10ms monitor the status of the network card
Configure BOND0
Note: Bond IP and member port IP is not consistent, if you do not want the member port IP to obtain the address of this network segment, you can arbitrarily configure one.
AutoLo iface lo inet loopback auto em2 iface em2 inet Static Address192.168.1.12Netmask255.255.0.0 #bond-master bond0Auto EM5 iface em5 inet Static Address192.168.1.11Netmask255.255.0.0 #bond-master bond0Auto bond0 iface bond0 inet Static Address192.168.1.5Netmask255.255.0.0Network192.168.1.0Broadcast192.168.1.255Gateway192.168.1.1Dns-nameservers8.8.8.8 #bond-mode 0 #bond-miimonUp Ifenslave bond0 em2 em5 down ifenslave-d bond0 em2 EM5
Restart reboot confirm Bond0 status
cat /proc/net/bonding/bond0
Prompt up is successful:
Ethernet Channel Bonding Driver:V3.7.1(April -, .)Bonding Mode:Load Balancing (Round-robin)MII Status:UpMII Polling Interval(MS): - up Delay(MS): 0 Down Delay(MS): 0Slave Interface:Em2MII Status:Up Speed: + MbpsDuplex:FullLink Failure Count: 0Permanent HW Addr:*:*:*:*:*:*SlaveQueueID: 0Slave Interface:Em5MII Status:Up Speed: - MbpsDuplex:FullLink Failure Count: 0Permanent HW Addr:*:*:*:*:*:*SlaveQueueID: 0
And down means that there may not be auto enabled (automatic
Enabled), you can try to start it manually:
ifconfig bond0 up
Ubuntu Server 14.04 LTS Multi-nic binding for load Balancing