標籤:bsp 網卡 vmware bootproto eth0 mac sys 問題 目錄
模式bond1: active-backup
模式的特點:一個連接埠處於主狀態 ,一個處於從狀態,所有流量都在主鏈路上處理,從不會有任何流量。當主連接埠down掉時,從連接埠接手主狀態。
先停止NetworkManager
service NetworkManager stop
chkconfig NetworkManager off //開機自啟動 關閉
在/etc/sysconfig/network-scripts/目錄下建立ifcfg-bond0檔案,檔案內容如下:
DEVICE=bond0USERCTL=noBOOTPROTO=noneONBOOT=yesIPADDR=192.168.100.17 //你所設定的IPNETMASK=255.255.255.0GATEWAY=192.168.100.1TYPE=UnKnown //或者Ethernet (若Networkmanager未關閉 就用unknown )BONDING_OPTS="miimon=80 mode=0" //這一步也可以在下面 /etc/modprobe.d/bonidng.conf 裡面填寫
綁定mode為0,是rond-robin模式。
然後分別修改ifcfg-eth0檔案,如下:
DEVICE="eth0"ONBOOT="yes"BOOTPROTO=noneMASTER=bond0SLAVE=yesUSERCTL=no
在把ifcfg-eth1檔案修改如下:
DEVICE="eth1"ONBOOT="yes"BOOTPROTO=noneMASTER=bond0SLAVE=yesUSERCTL=no
在/etc/modprobe.d/目錄下建立bonding.conf檔案,檔案內容如下:
alias bond0 bonding
---若上一面bond0 配置未填寫 BONDING_OPTS,這裡再另起一行:options bond0 miimon=100 mode=0
執行
modprobe bonding
然後重啟網路
service network restart
-------如果用遠端連線的話 請使用:modprobe bonding&&service network restart
之後就可以用ifconfig-a看到綁定好的bond0網卡,bond0與eth0,eth1的mac地址均為一樣。
可以同過cat/proc/net/bonding/bond0 此命令查看綁定情況
網卡綁定解除:
刪除ifcfg-bond0,和刪除/etc/modprobe.d/bonding.conf
修改ifcfg-eth0和ifcfg-eth0為綁定之前的樣子
rmmod bonding(很重要)
service network restart
注意事項:
1.Warning: the permanent HWaddr of eth0 - 00:0c:29:2d:4a:87 - is still in use by bond0. Set the HWaddr of eth0 to a different address to avoid conflicts.
an:在網上查了下,很多人都說是VMware workstation的問題,實體機做沒問題。具體原因不太清楚,我上網查的資料:http://blog.csdn.net/robertkun/article/details/16873961,不過我還沒試。
最直接的解決辦法:建議測試的時候不要用ifdown eth0來測試,而是在workstation右下角找到eth0網路介面卡,右鍵中斷連線。
2.為什麼eth0修複後,bond0不返回eth0
3.
[[email protected] network-scripts]# cat ifcfg-bond0 DEVICE=bond0ONBOOT=yes#雙網卡IPIPADDR=192.168.1.100GATEWAY=192.168.1.1NETMASK=255.255.255.0#mode0代表Active-backup policy(主-備份策略)BONDING_OPTS="miimon=80 mode=1"[[email protected] network-scripts]# cat ifcfg-ethcat: ifcfg-eth: No such file or directory[[email protected] network-scripts]# cat ifcfg-eth0DEVICE="eth0"#IPADDR=192.168.1.200#NM_CONTROLLED="yes"ONBOOT="yes"#NETMASK=255.255.255.0#GATEWAY=192.168.1.1MASTER=bond0SLAVE=yesTYPE="Ethernet"UUID="a90ad08d-f6e9-4f34-94e3-690d44454e9e"[[email protected] network-scripts]# cat ifcfg-eth1DEVICE="eth1"#IPADDR=192.168.174.200#NM_CONTROLLED="yes"ONBOOT="yes"MASTER=bond0SLAVE=yes#NETMASK=255.255.255.0#GATEWAY=192.168.1.1#TYPE="Ethernet"#UUID="a90ad08d-f6e9-4f34-94e3-690d44454e9e"
感謝:http://blog.csdn.net/yh10169658/article/details/52220582
linux 雙網卡綁定~