您的位置:首页 > 运维架构 > Linux

Linux bond or team multiple network interfaces (NIC)into single interface

2013-08-03 17:04 459 查看
Linux bond or team multiple network interfaces (NIC)into single interface
Finally today I had implemented NIC bounding (bind bothNIC so that it works as a single device). We have two Dell servers that needsetup with Intel Dual Gig NIC. My idea is to improve performance by pumping outmore data from both NIC without using any other method.This box act as heavy duty ftp server. Each night I needto transfer over 200GB data from this box to another box. Therefore, thenetwork would be setup is two servers on a switch using dual network cards. Iam using Red Hat enterprise Linux version 4.0.Linux allowsbinding multiple network interfaces into a single channel/NIC using specialkernel module called bonding. According to official bonding documentation, "The Linux bonding driverprovides a method for aggregating multiple network interfaces into a singlelogical "bonded" interface. The behavior of the bonded interfacesdepends upon the mode; generally speaking, modes provide either hot standby orload balancing services. Additionally, link integrity monitoring may beperformed."Setting up bounding is easy with RHEL v4.0.Step #1: Create a bond0 configuration fileRed Hat Linuxstores network configuration in /etc/sysconfig/network-scripts/ directory. First, you needto create bond0 config file:
# vi/etc/sysconfig/network-scripts/ifcfg-bond0Append followinglines to it:DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yesReplace above IPaddress with your actual IP address. Save file and exit to shell prompt.Step #2: Modify eth0 and eth1 config files:Open bothconfiguration using vi text editor and make sure file read as follows for eth0interface# vi/etc/sysconfig/network-scripts/ifcfg-eth0Modify/appenddirective as follows:DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=noneOpen eth1configuration file using vi text editor:# vi/etc/sysconfig/network-scripts/ifcfg-eth1Make sure fileread as follows for eth1 interface:DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=noneSave file andexit to shell prompt.Step # 3: Load bond driver/moduleMake surebonding module is loaded when the channel-bonding interface (bond0) is broughtup. You need to modify kernel modules configuration file:# vi/etc/modprobe.confAppend followingtwo lines:aliasbond0 bonding
options bond0 mode=balance-alb miimon=100Save file andexit to shell prompt. You can learn more about all bounding options in kernelsource documentation file (click here to read file online).Step # 4: Test configurationFirst, load thebonding module:#modprobe bondingRestartnetworking service in order to bring up bond0 interface:#service network restartVerifyeverything is working:#less /proc/net/bonding/bond0Output:Bonding Mode: load balancing (round-robin)MII Status: upMII Polling Interval (ms): 0Up Delay (ms): 0Down Delay (ms): 0
Slave Interface: eth0MII Status: upLink Failure Count: 0Permanent HW addr: 00:0c:29:c6:be:59
Slave Interface: eth1MII Status: upLink Failure Count: 0Permanent HW addr: 00:0c:29:c6:be:63List allinterfaces:#ifconfigOutput:bond0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::200:ff:fe00:0/64Scope:Link UP BROADCAST RUNNING MASTERMULTICAST MTU:1500 Metric:1 RX packets:2804 errors:0 dropped:0overruns:0 frame:0 TX packets:1879 errors:0 dropped:0overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fec6:be59/64 Scope:Link UP BROADCAST RUNNING SLAVEMULTICAST MTU:1500 Metric:1 RX packets:2809 errors:0 dropped:0overruns:0 frame:0 TX packets:1390 errors:0 dropped:0overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:251161 (245.2 KiB) TX bytes:180289 (176.0 KiB) Interrupt:11 Base address:0x1400
eth1 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59 inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fec6:be59/64 Scope:Link UP BROADCAST RUNNING SLAVEMULTICAST MTU:1500 Metric:1 RX packets:4 errors:0 dropped:0overruns:0 frame:0 TX packets:502 errors:0 dropped:0overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB) Interrupt:10 Base address:0x1480Now you have bond multiple network interfaces into asingle channel (NIC)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: