1. mode=0 (Round-robin)
Link aggregation: Combines two or more data channels into a single channel, which appears at a higher bandwidth logical link, where link aggregation is typically used to connect one or more bandwidth-demanding devices, and link aggregation refers to binding multiple physical ports together to become a logical port.
In order to realize the load sharing in the port of each member, when a member port fails, the message is stopped and the message is sent in the remaining link according to the load sharing strategy, and the port of the message is recalculated after the port is restored. Link aggregation is a very important technique in increasing bandwidth, realizing link transmission elasticity and redundancy.
The bandwidth of the logical link increases by about (n-1) times, where n is the number of aggregations, the aggregation, the reliability is greatly improved, as long as one link in the N link works properly, this link can work, in addition to the link aggregation can achieve load balance.
Link aggregation has the following advantages:
(1) Increase the bandwidth. Link aggregation can bundle multiple links on a single logical link, and the bundled link bandwidth is the sum of each independent link.
(2) Improve the reliability of network connection. Multiple links in a link aggregation are backed up, and when one link is broken, the traffic is automatically redistributed across the remaining links.
[Email protected] ~]# cd/etc/sysconfig/network-scripts/[[Email protected] network-scripts]# Vim ifcfg-Eth1device=Eth1bootproto=Nonetype=Ethernetpeerdns=Yesmaster=Bond0slave=Yes[[email protected] Network-scripts]# Vim ifcfg-Eth2device=Eth2type=Ethernetbootproto=Nonepeerdns=Yesonboot=Yesmaster=Bond0slave=Yes
[[Email protected] network-scripts]# Vim ifcfg-bond0 # New ifcfg-bond0 file Device=Bond0bootproto=Nonetype=ethernetipaddr=192.168.2.11NETMASK=255.255.255.0GATEWAY=192.168.2.1DNS1=192.168.2.1DNS2=114.114.114.114
[email protected] network-scripts]# vim/etc/modprobe.d/bond0.conf3
alias bond0 Bonding
options bond0 miimon=100 mode=0
[email protected] network-scripts]# service network restart
shutting down interface bond0: [OK]
Close Loopback interface: [OK]
Eject Loopback interface: [OK]
Popup Interface bond0: [OK]
This way the mode=0 (round-robin) Double NIC Link aggregation is established.
[Email protected] ~]# cat/proc/net/bonding/bond0 Ethernet Channel Bonding driver:v3.6.0(September -, the) Bonding mode:load balancing (round - Robin) # Status changed to round-Robin is currently two network cards: eth1 and eth2 MII status:upmii Polling Interval (ms): -Up Delay (ms):0Down Delay (ms):0Slave interface:eth1mii status:upspeed: +mbpsduplex:fulllink Failure Count:0Permanent HW Addr:xx: 0c: in: 7b:9f:8cslave queue ID:0Slave interface:eth2mii status:upspeed: +mbpsduplex:fulllink Failure Count:0Permanent HW Addr:xx: 0c: in: 7b:9f: theSlave Queue ID:0
[[Email protected] ~]# IP a1: Lo: <LOOPBACK,UP,LOWER_UP> MTU16436qdisc noqueue State UNKNOWN Link/loopbackxx:xx:xx:xx:xx:xxBrdxx:xx:xx:xx:xx:xxinet127.0.0.1/8Scope host lo inet6::1/ -Scope host Valid_lft forever Preferred_lft forever2: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU theQdisc Pfifo_fast Master bond0 State up Qlen +Link/ether xx: 0c: : 7b:9f:8c BRD ff:ff:ff:ff:ff:ff3: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU theQdisc Pfifo_fast Master bond0 State up Qlen +Link/ether xx: 0c: : 7b:9f:8c BRD ff:ff:ff:ff:ff:ff4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> MTU theQdisc noqueue State up link/ether xx: 0c: : 7b:9f:8c brd ff:ff:ff:ff:ff:ff inet192.168.2.11/ -Brd192.168.2.255ScopeGlobalbond0 Inet6 fe80::20c:29ff:fe7b:9f8c/ -scope link Tentative dadfailed valid_lft forever Preferred_lft Forever
Mode 0 under Bond the IP of the NIC adapter is modified to the same MAC address, if these network cards are connected to the same switch, then the ARP table of the switch, the MAC address corresponds to a number of ports, then the switch to accept the MAC address of the packet where should be sent?
Under normal circumstances the MAC address is unique, and a MAC address corresponding to multiple ports will definitely confuse the switch. So in mode 0, bond is connected to the switch, and the switch ports should be aggregated.
2. mode=1 (Active-backup)
Primary and Standby network card, one network card is active, the other network card is in the backup state, all traffic is processed on the main link, when the active link (primary link) down, enable the backup network card
The above network adapter configuration is the same. The only place to change when the mode is switched.
[Email protected] ~]# vim/etc/modprobe.d/bond0.confalias bond0 bondingoptions bond0 Miimon= mode =1
[Email protected] ~]# cat/proc/net/bonding/bond0 Ethernet Channel Bonding driver:v3.6.0(September -, the) Bonding Mode:fault-tolerance(active- Backup) Primary slave:nonecurrently Active slave:eth1 # current active NIC is eth1, backup NIC is eth2MII status:upmii Polling Interval (ms): -Up Delay (ms):0Down Delay (ms):0Slave interface:eth1mii status:upspeed: +mbpsduplex:fulllink Failure Count:0Permanent HW Addr:xx: 0c: in: 7b:9f:8cslave queue ID:0Slave interface:eth2mii status:upspeed: +mbpsduplex:fulllink Failure Count:0Permanent HW Addr:xx: 0c: in: 7b:9f: theSlave Queue ID:0
Summary Two commonly used dual-NIC bindings under Linux