First, what is bonding
Bonding, is to bind multiple network cards to the same IP address to provide services, can achieve high availability or load balancing. Of course, it is not possible to set the same IP address directly for two NICs. Through the bonding, the virtual one network card provides the connection externally, the physical network card is modified to the same MAC address.
Ii. Several working modes of bonding
Mode 0 (BALANCE-RR)
Rotation (round-robin) strategy: Send packets above and below each slave interface in a sequential order. This mode provides load balancing and fault tolerance capabilities
Mode 1 (active-backup)
Active-Backup (Master) policy: In the binding, only one slave is activated. Other slave are activated when and only if the active slave interface fails. To prevent the switch from confusing, the bound MAC address is visible on only one external port
Mode 3 (broadcast)
Broadcast strategy: All messages are transmitted on all slave interfaces. This mode provides fault-tolerant capability.
Iii. Mode1 Configuration demo in bonding
1, first add a network card on the virtual machine
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/86/D9/wKiom1fNDTHBiLnUAAB9n86RGl0599.png "title=" 2016-09-05_140906.png "alt=" Wkiom1fndthbilnuaab9n86rgl0599.png "/>
[[email protected] ~]# ifconfig -a // ifconfig -a View all network card devices eth0 link encap:ethernet Hwaddr 00:0c:29:9c:63:16 inet addr:10.1.252.122 Bcast:10.1.255.255 Mask:255.255.0.0 inet6 addr: fe80::20c:29ff:fe9c:6316/64 Scope:Link UP BROADCAST RUNNING MULTICAST mtu:1500 metric:1 rx packets :111504 errors:0 dropped:0 overruns:0 frame:0 TX packets:1487 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8815045 (8.4 MIB) TX bytes:176077 (171.9 kib) eth1 Link encap:Ethernet HWaddr 00:0C:29:9C:63:20 Added success! BROADCAST MULTICAST MTU:1500 metric:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host up loopback running mtu:65536 metric:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Ii. creating a configuration file for the bonding device
[Email protected] ~]# vi/etc/sysconfig/network-scripts/ifcfg-bond0device=bond0ipaddr=10.1.0.222netmask= 255.255.0.0gateway=10.1.0.1dns1=114.114.114.114bonding_opts= "Miimon=100 mode=1"
Third, create the configuration file of network card
[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth*device= "eth0" slave=yesmaster=bond0device= "eth1 "Slave=yesmaster=bond0[[email protected] ~]#
Four, restart the network card configuration file and test
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/86/D9/wKiom1fNEhSzSO4XAABTnwdsPaw238.png "title=" 2016-09-05_143148.png "alt=" Wkiom1fnehszso4xaabtnwdspaw238.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/D8/wKioL1fNEsjwtfC7AAAoBsHruws995.png "title=" 2016-09-05_143521.png "alt=" Wkiol1fnesjwtfc7aaaobshruws995.png "/>
ping10.1.0.222 this host
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/86/D9/wKiom1fNE6-S7j-DAAAON_NaN34375.png "title=" 2016-09-05_143409.png "alt=" Wkiom1fne6-s7j-daaaon_nan34375.png "/>
Then disconnect eth0 this NIC
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/D9/wKiom1fNE8uQAz__AAAXI-KOBrg078.png "title=" 2016-09-05_143736.png "alt=" Wkiom1fne8uqaz__aaaxi-kobrg078.png "/>
View the information at this time
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/D9/wKiom1fNFD6j4UXcAAAobPEVL44556.png "title=" 2016-09-05_144116.png "alt=" Wkiom1fnfd6j4uxcaaaobpevl44556.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/86/D9/wKiom1fNFIvg54sAAAAn9EzHWZY370.png "title=" 2016-09-05_144250.png "alt=" Wkiom1fnfivg54saaaan9ezhwzy370.png "/>
Then disconnect the eth1, and then ping the host
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/86/D8/wKioL1fNFVrDPQDWAAAjsrBe0Bk756.png "title=" 2016-09-05_144625.png "alt=" Wkiol1fnfvrdpqdwaaajsrbe0bk756.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/D9/wKiom1fNFWfjDW8GAAAIMKTOUaU416.png "title=" 2016-09-05_144504.png "alt=" Wkiom1fnfwfjdw8gaaaimktouau416.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/86/D8/wKioL1fNFfexX3lhAAAoLs_fTc4351.png "title=" 2016-09-05_144848.png "alt=" Wkiol1fnffexx3lhaaaols_ftc4351.png "/>
Because the two network cards are disconnected, so no one to provide services, let us once again to connect the eth0, and then ping the host again
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/D9/wKiom1fNFkTxYnGgAAAhePHQ8fI855.png "title=" 2016-09-05_145006.png "alt=" Wkiom1fnfktxynggaaahephq8fi855.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/D8/wKioL1fNFuzw7tnIAAAon3amQo0866.png "title=" 2016-09-05_145258.png "alt=" Wkiol1fnfuzw7tniaaaon3amqo0866.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/D9/wKiom1fNFyXgQGTAAAAn90Ss3hg080.png "title=" 2016-09-05_145357.png "alt=" Wkiom1fnfyxgqgtaaaan90ss3hg080.png "/>
Experimental success!! Thanks for browsing!!
This article is from the "Endless Learning" blog, please be sure to keep this source http://dashui.blog.51cto.com/11254923/1846417
Linux under multiple NIC bonding