Linux下設定網路卡繫結 (final)

tolywang發表於2011-06-16

 

eth0 及eth2 繫結為 bond0 
eth1 及eth3 繫結為 bond1  

 

[root@wsjrac03 network-scripts]# cp  ifcfg-eth0  ifcfg-bond0
[root@wsjrac03 network-scripts]# cat ifcfg-bond0

DEVICE=bond0
BOOTPROTO=none
IPADDR=10.109.196.155
NETMASK=255.255.255.0
NETWORK=10.109.196.0
BROADCAST=10.109.196.255
GATEWAY=10.109.196.1
ONBOOT=yes
USERCTL=no 
TYPE=Ethernet

 

[root@wsjrac03 network-scripts]# cp  ifcfg-eth1  ifcfg-bond1 
[root@wsjrac03 network-scripts]# cat ifcfg-bond1

DEVICE=bond1
BOOTPROTO=none
IPADDR=10.1.1.155
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

 


[root@wsjrac03 network-scripts]# cat ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
HWADDR=A4:BA:DB:35:1B:AA
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
USERCTL=no
slave=yes

 

[root@wsjrac03 network-scripts]# cat ifcfg-eth1

DEVICE=eth1
BOOTPROTO=none
HWADDR=A4:BA:DB:35:1B:AC
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
MASTER=bond1
slave=yes

 

[root@wsjrac03 network-scripts]# cat ifcfg-eth2

DEVICE=eth2
BOOTPROTO=none
HWADDR=A4:BA:DB:35:1B:AE
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
USERCTL=no
slave=yes


[root@wsjrac03 network-scripts]# cat ifcfg-eth3

DEVICE=eth3
BOOTPROTO=none
HWADDR=A4:BA:DB:35:1B:B0
ONBOOT=yes
TYPE=Ethernet
MASTER=bond1
USERCTL=no
slave=yes

 


[root@wsjrac03 etc]# cat modprobe.conf

alias bond0 bonding
options bond0 miimon=100 mode=1  primary=eth0
alias bond1 bonding
options bond1 miimon=100 mode=1  primary=eth1  

 

 

[root@wsjrac03 etc]# vi /etc/rc.local

touch /var/lock/subsys/local
ifenslave bond0 eth0 eth2
ifenslave bond1 eth1 eth3

 

 


重新啟動後檢視 :


下面bond0對應線只有一個接了網線,所以狀態是一個up, 一個down . 

[root@wsjrac01 oracle]# more /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth0
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: a4:ba:db:34:8e:70

Slave Interface: eth2
MII Status: down
Link Failure Count: 0
Permanent HW addr: a4:ba:db:34:8e:74

 

下面心跳線都接了網線,所以狀態都是UP

[root@wsjrac01 oracle]# more /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth3
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Link Failure Count: 1
Permanent HW addr: a4:ba:db:34:8e:72

Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr: a4:ba:db:34:8e:76
[root@wsjrac01 oracle]#

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-700060/,如需轉載,請註明出處,否則將追究法律責任。

相關文章