搜尋此網誌
Channel Bonding
這篇是實作bonding的概念(兩張網卡的備援機制)
概念 : 主要有兩個腳色,Master(ifcfg-bond0)與Slave(eth0、eth1)
當eth0網卡掛掉的時候,eth1會直接接管,讓網路正常運作
LAB:
首先先在虛機新增網路介面卡(e1000) <--- eth1
#service NetworkManager stop
#chkconfig NetworkManager off
[Slave(eth0、eth1)]
#echo 'DEVICE=eth1' > /etc/sysconfig/network-scripts/ifcfg-eth1
#echo 'ONBOOT=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1
#echo 'MASTER=bond0' >> /etc/sysconfig/network-scripts/ifcfg-eth1
#echo 'SLAVE=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1
因為eth0的設定是跟eth1一樣的,只有DEVICE的部分需要更改而已
所以
#cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth0
#sed -i 's/eth1/eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
這樣SLAVE的部分就算是大功告成了,再來就要設定他們的主人了
#echo 'DEVICE=bond0' >> /etc/sysconfig/network-scripts/ifcfg-bond0
#echo 'ONBOOT=yes' >> /etc/sysconfig/network-scripts/ifcfg-bond0
#echo 'IPADDR=192.168.0.140' >> /etc/sysconfig/network-scripts/ifcfg-bond0
#echo 'PREFIX=24' >> /etc/sysconfig/network-scripts/ifcfg-bond0
#echo 'BONDING_OPTS="mode=1 miimon=50"' >> /etc/sysconfig/network-scripts/ifcfg-bond0
#cat /etc/sysconfig/network-scripts/ifcfg-bond0
#service network restart