NIC channel bonding allows multiple network cards to act as one, allowing increased bandwidth and redundancy.Let's assume we have two network interfaces ("eth0" and "eth1") and we want to bond them so they look like a single interface ("bond0").Add the following line to the "/etc/modprobe.conf" file.============================= alias bond0 bonding============================= The files defining the regular and bonded interfaces are located in the "/etc/sysconfig/network-scripts" directory. Create a new file called "ifcfg-bond0" for the bonded interface with the following contents (adjust the network parameters as applicable).============================= [root@rhel5 network-scripts]# cat ifcfg-bond0# Intel Corporation 82540EM Gigabit Ethernet ControllerDEVICE=bond0BOOTPROTO=staticONBOOT=yesUSERCTL=noIPADDR=192.168.99.131NETMASK=255.255.255.0BONDING_OPTS="mode=1 miimon=100"============================= 說明:miimon是用來進行鏈路監測的。 比如:miimon=100,那麼系統每100ms監測一次鏈路串連狀態,如果有一條線路不通就轉入另一條線路;mode的值表示工作模式,他共有0,1,2,3四種模式,常用的為0,1兩種。mode=0表示load balancing (round-robin)為負載平衡方式,兩塊網卡都工作。mode=1表示fault-tolerance (active-backup)提供冗餘功能,工作方式是主備的工作方式,也就是說預設情況下只有一塊網卡工作,另一塊做備份.bonding只能提供鏈路監測,即從主機到交換器的鏈路是否接通。如果只是交換器對外的鏈路down掉了,而交換器本身並沒有故障,那麼bonding會認為鏈路沒有問題而繼續使用Amend the existing "ifcfg-eth0" and "ifcfg-eth1" files, adding the "MASTER" and "SLAVE" parameters. The contents of these files should look like this.============================= [root@rhel5 network-scripts]# cat ifcfg-eth0# Intel Corporation 82540EM Gigabit Ethernet ControllerDEVICE=eth0BOOTPROTO=noneUSERCTL=noONBOOT=yesMASTER=bond0SLAVE=yes[root@rhel5 network-scripts]# cat ifcfg-eth1# Intel Corporation 82540EM Gigabit Ethernet ControllerDEVICE=eth1BOOTPROTO=noneONBOOT=yesUSERCTL=noneMASTER=bond0SLAVE=yes============================= Restart the network service.============================= # service network restart============================= Once the bond is configured it acts like any other Ethernet device. For example, you can configure alias interfaces to handle multiple IP addresses, as shown below.Create the "ifcfg-bond0:1" and "ifcfg-bond0:2" files in the "/etc/sysconfig/network-scripts" directory with the following contents.============================= # ifcfg-bond0:1 file contentsDEVICE=bond0:1BOOTPROTO=noneONBOOT=yesNETWORK=192.168.0.0NETMASK=255.255.255.0IPADDR=192.168.0.172USERCTL=noBONDING_OPTS="mode=1 miimon=100"# ifcfg-bond0:2 file contentsDEVICE=bond0:2BOOTPROTO=noneONBOOT=yesNETWORK=192.168.0.0NETMASK=255.255.255.0IPADDR=192.168.0.173USERCTL=noBONDING_OPTS="mode=1 miimon=100"============================= Restart the network service for the changes to take effect.通過查看bond0的工作狀態查詢能詳細的掌握bonding的工作狀態[root@redflag bonding]# cat /proc/net/bonding/bond0bonding.c:v2.4.1 (September 15, 2003)Bonding Mode: load balancing (round-robin)MII Status: upMII Polling Interval (ms): 0Up Delay (ms): 0Down Delay (ms): 0Multicast Mode: all slavesSlave Interface: eth1MII Status: upLink Failure Count: 0Permanent HW addr: 00:0e:7f:25:d9:8aSlave Interface: eth0MII Status: upLink Failure Count: 0Permanent HW addr: 00:0e:7f:25:d9:8b