NIC Teaming
發表於 : 2012-07-10 09:13:21
http://www.cyberciti.biz/tips/linux-bon ... rface.html
Step #1: Create a Bond0 Configuration File
Red Hat Enterprise Linux (and its clone such as CentOS) stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create a bond0 config file as follows:
Append the following linest:
You need to replace IP address with your actual setup. Save and close the file.
Step #2: Modify eth0 and eth1 config files
Open both configuration using a text editor such as vi/vim, and make sure file read as follows for eth0 interface
Modify/append directive as follows:
Open eth1 configuration file using vi text editor, enter:
Make sure file read as follows for eth1 interface:
Save and close the file.
Step # 3: Load bond driver/module
Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:
Append following two lines:
Save file and exit to shell prompt. You can learn more about all bounding options by clicking here).
Step # 4: Test configuration
First, load the bonding module, enter:
Restart the networking service in order to bring up bond0 interface, enter:
Make sure everything is working. Type the following cat command to query the current status of Linux kernel bounding driver, enter:
Sample outputs:
To kist all network interfaces, enter:
Sample outputs:
Step #1: Create a Bond0 Configuration File
Red Hat Enterprise Linux (and its clone such as CentOS) stores network configuration in /etc/sysconfig/network-scripts/ directory. First, you need to create a bond0 config file as follows:
代碼: 選擇全部
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
代碼: 選擇全部
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
Step #2: Modify eth0 and eth1 config files
Open both configuration using a text editor such as vi/vim, and make sure file read as follows for eth0 interface
代碼: 選擇全部
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
代碼: 選擇全部
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
HWADDR=xx:xx:xx:xx:xx:C1
代碼: 選擇全部
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
代碼: 選擇全部
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
HWADDR=xx:xx:xx:xx:xx:C2
Step # 3: Load bond driver/module
Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:
代碼: 選擇全部
# vi /etc/modprobe.d/bonding.conf
代碼: 選擇全部
alias bond0 bonding
options bond0 mode=balance-alb miimon=100
Step # 4: Test configuration
First, load the bonding module, enter:
代碼: 選擇全部
# modprobe bonding
代碼: 選擇全部
# service network restart
代碼: 選擇全部
# cat /proc/net/bonding/bond0
代碼: 選擇全部
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:C1
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: xx:xx:xx:xx:xx:C2
代碼: 選擇全部
# ifconfig
代碼: 選擇全部
bond0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:C1
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:C1
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:1390 errors:0 dropped:0 overruns: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 xx:xx:xx:xx:xx:C2
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB)
Interrupt:10 Base address:0x1480