Linux system to do a dual-NIC binding, after experiments to obtain the following steps
System version: Centosrelease 6.8 (Final)
System kernel version:2.6.32-642.el6.x86_64
The 1.1 NIC is configured as follows
Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Onboot=yes
Bootproto=dhcp
Cat/etc/sysconfig/network-scripts/ifcfg-eth1
Device=eth1
Onboot=yes
Bootproto=dhcp
Cat/etc/sysconfig/network-scripts/ifcfg-bond0
Device=bond0
Type=ethernet
Onboot=yes
Bootproto=static
ipaddr=192.168.137.10
netmask=255.255.255.0
dns1=202.96.128.166
1.2 configuration /etc/modprobe.d/dist.conf file, plus the following configuration
Alias Bond0 Bonding
Options bond0 miimon=100 mode=1 #若想使用负载均衡模式, modify the mode=0, other configurations are not moved
Description
Miimon is the number of milliseconds, triggering an event that detects line stability every 100 milliseconds
Mode is the working state of Ifenslave.
Miimon=100 means that the system every 100MS monitoring link connection status, if one line is not connected to another line (this monitoring is monitoring the server to the switch between the lines, the switch above the line is disconnected, this monitoring line also shows that there is no failure problem)
Mode=1 represents Active-backup, provides redundancy, the mode of operation is the main standby, by default, only one network card work, the other to do backup network card
Mode=0 represents Round-robin, load balancing, this state does not increase the bandwidth, just in two network card polling work, the bandwidth rate of the two network cards is average, but also support fault tolerance (this state requires the switch to do the aggregation port)
1.3 configuration /etc/rc.local, plus the following configuration
Ifenslave bond0 eth0 eth1 #启动将eth0, eth1 bound to Bond0
Route add default GW 192.168.137.1 bond0 #启动添加默认网关
1.4 Viewing network card information
Ifconfig
Bond0 linkencap:ethernet HWaddr 00:0c:29:a6:77:fa
inetaddr:192.168.137.10 bcast:192.168.137.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FEA6:77FA/64 Scope:link
Up broadcast Runningmaster multicast mtu:1500 metric:1
RX packets:1737errors:0 dropped:0 overruns:0 frame:0
TX packets:930errors:0 dropped:0 overruns:0 carrier:0
collisions:0txqueuelen:0
RX bytes:138239 (134.9 KiB) TX bytes:105449 (102.9 KiB)
Eth0 linkencap:ethernet HWaddr 00:0c:29:a6:77:fa
Inet6 ADDR:FE80::20C:29FF:FEA6:77FA/64 Scope:link
Up broadcast Runningslave multicast mtu:1500 metric:1
RX packets:1521errors:0 dropped:0 overruns:0 frame:0
TX packets:746errors:0 dropped:0 overruns:0 carrier:0
collisions:0txqueuelen:1000
RX bytes:124324 (121.4 KiB) TX bytes:94507 (92.2 KiB)
eth1 Link encap:ethernet HWaddr 00:0c:29:a6:77:fa
Up broadcast Runningslave multicast mtu:1500 metric:1
RX packets:221errors:0 dropped:0 overruns:0 frame:0
TX packets:199errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
rxbytes:15061 (14.7 KiB) TX bytes:12592 (12.2 KiB)
Description
bond0 , eth0 , eth1 of the MAC the addresses are all the same.
1.5 View bond0 information
Cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)
Bonding mode:fault-tolerance (active-backup) #主备模式
Primary Slave:none
Currently Active Slave:eth0
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth0
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW Addr: 00:0c:29:a6:77:fa
Slave Queue id:0
Slave interface:eth1
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW Addr: 00:0c:29:a6:77:04
Slave Queue id:0
Description
actual eth0 and the eth1 of the MAC The address is not the same
1.6 Test Results
Ping192.168.137.10–t
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/2B/wKiom1hGKWnBQU2cAAAmNrp9ZqI912.png-wh_500x0-wm_3 -wmp_4-s_3924030573.png "title=" 1.png "alt=" Wkiom1hgkwnbqu2caaamnrp9zqi912.png-wh_50 "/>
Physical Disconnect eth0:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/8B/28/wKioL1hGKXrSgcvGAAAqTJWKnKM295.png-wh_500x0-wm_3 -wmp_4-s_2165661720.png "title=" 2.png "alt=" Wkiol1hgkxrsgcvgaaaqtjwknkm295.png-wh_50 "/>
View bond0 information:eth0 disconnected, system using eth1 Nic
Cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)
Bonding mode:fault-tolerance (Active-backup)
Primary Slave:none
Currently Active Slave:eth1
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth0
MII Status:down
Speed:unknown
Duplex:unknown
Link Failure count:1
Permanent HW ADDR:00:0C:29:A6:77:FA
Slave Queue id:0
Slave interface:eth1
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW addr:00:0c:29:a6:77:04
Slave Queue id:0
This article is from the "Bin Less Technology blog" blog, please be sure to keep this source http://yinjianbin.blog.51cto.com/4529118/1879886
Linux system dual NIC binding