環境:RHEL 6.5
注意:此處的機器環境是3網卡,我用eth0連ssh的,但是一直掉...
需要關閉NetworkManager,並將其設置為開機不啟動(這個玩意兒真煩)vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
TYPE=Ethernet
IPADDR=192.168.115.50
NETMASK=255.255.255.0
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
vim /etc/modprobe.d/dist.conf
alias bond0 bonding
options bond0 mode=0 miimon=100
mode 0表示為負載均衡模式,兩塊網卡都工作
mode 1表示冗余模式,一塊是工作,一塊冗余
miimon表示系統檢查間隔時間,單位是ms,
例如:每100ms檢查一次,當發現一條線路不通,就轉入另一條
vim /etc/rc.local
ifenslave bond0 eth1 eth2
[root@oratest0 ~]# ifconfig
bond0 Link encap:EthernetHWaddr00:0C:29:44:52:23
inet addr:192.168.115.50Bcast:192.168.115.255Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe44:5223/64Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500Metric:1
RX packets:878 errors:0 dropped:0 overruns:0 frame:0
TX packets:349 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:81301(79.3KiB) TX bytes:58143(56.7KiB)
eth0 Link encap:EthernetHWaddr00:0C:29:44:52:19
inet addr:192.168.115.40Bcast:192.168.115.255Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe44:5219/64Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500Metric:1
RX packets:170 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15663(15.2KiB) TX bytes:746(746.0 b)
eth1 Link encap:EthernetHWaddr00:0C:29:44:52:23
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500Metric:1
RX packets:702 errors:0 dropped:0 overruns:0 frame:0
TX packets:175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:65260(63.7KiB) TX bytes:27907(27.2KiB)
eth2 Link encap:EthernetHWaddr00:0C:29:44:52:23
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500Metric:1
RX packets:176 errors:0 dropped:0 overruns:0 frame:0
TX packets:174 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16041(15.6KiB) TX bytes:30236(29.5KiB)
lo Link encap:LocalLoopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr:::1/128Scope:Host
UP LOOPBACK RUNNING MTU:16436Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:840(840.0 b) TX bytes:840(840.0 b)
cat /proc/net/bonding/bond0
更多RedHat相關信息見RedHat 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=10