In the platform, we have to take into account the network adapter or switch hardware corruption, or line failure caused by the server offline. We can use a dual-NIC binding to implement redundancy for network adapters or lines, or to increase network throughput.
Configuration Examples
Create a configuration file for the virtual NIC Bond0
Shell> #vi/etc/sysconfig/network-scripts/ifcfg-bond0
Device=bond0 Bootproto=none Onboot=yes Userctl=no ipaddr=192.168.37.110 netmask=255.255.255.0 gateway=192.168.37.1 dns1=127.0.0.1 |
To modify the ETH0/ETH1 network card configuration file
Shell> #vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 Type=ethernet Onboot=yes Nm_controlled=no Bootproto=none Master=bond0 Slave=yes |
Shell> #vi/etc/sysconfig/network-scripts/ifcfg-eth1
Device=eth1 Type=ethernet Onboot=yes Nm_controlled=no Bootproto=none Master=bond0 Slave=yes |
Modify the/etc/modprobe.conf file
shell># vi/etc/modprobe.conf
Alias Bond0 Bonding Options Bond0 miimon=100 mode=0 |
Here are the options described below
Miimon is the time interval unit of the link monitoring is the millisecond, miimon=100 means that every 100 milliseconds to detect connectivity between the network card and the switch, such as the use of additional links in general. mode=0 represents a load balancing method, both NICs work and require a switch for support. mode=1 indicates redundancy, the NIC has only one job, one problem enables the other. mode=6 represents a load balancing method, both NICs work and do not require a switch for support. |
Restart Network
shell># Service Network Restart
Validation results
shell># ifconfig
Bond0 Link encap:ethernet HWaddr 00:0c:29:dc:63:c7 inet addr:192.168.37.110 bcast:192.168.37.255 mask:255.255.255.0 Inet6 ADDR:FE80::20C:29FF:FEDC:63C7/64 Scope:link Up broadcast RUNNING MASTER multicast mtu:1500 metric:1 RX packets:2426 errors:0 dropped:0 overruns:0 frame:0 TX packets:1728 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:200041 (195.3 KiB) TX bytes:176604 (172.4 KiB) Eth0 Link encap:ethernet HWaddr 00:0c:29:dc:63:c7 Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1 RX packets:2407 errors:0 dropped:0 overruns:0 frame:0 TX packets:1268 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:198586 (193.9 KiB) TX bytes:139047 (135.7 KiB) eth1 Link encap:ethernet HWaddr 00:0c:29:dc:63:c7 Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1 RX packets:19 errors:0 dropped:0 overruns:0 frame:0 TX packets:460 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1455 (1.4 KiB) TX bytes:37557 (36.6 KiB) 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:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:340 (340.0 b) TX bytes:340 (340.0 b) |
View Bond0 's working status
Shell> #more/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.6.0 (September 26, 2009) Bonding mode:load Balancing (round-robin) 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:dc:63:c7 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:dc:63:d1 Slave Queue id:0 |
Now our NIC bindings are no problem.
This article is from the Blue Wings blog, so be sure to keep this source http://wqlszy2016.blog.51cto.com/2668358/1891340
Linux system initialization-improves network availability or performance (dual NIC bundling)