今天工作中配置了一下Redhat 6 系統下的網卡綁定:
主要是參照了如下兩個地方的說明:
我的兩個問題是:
- 我在redhat 6 上怎么配置這個網卡綁定,并且重啟后還能正常工作。
- 交換機上配置正常否?
這兩個問題都得到了解答,最后配置了一個四個網卡的bonding, 用的是默認的mode, 也就是mode 0, Round Robin.
這種模式還需要在交換機里配置一下。
大體步驟如下:
卸載 NetworkManager, 這個一直沒啥用。
modprobe --first-time bonding
在/etc/sysconfig/network-script/下創建ifcfg-bond0 文件,文件配置如下:
DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
NM_CONTROLLED=no
BONDING_OPTS="bonding parameters separated by spaces"
在/etc/sysconfig/network-script/ 下其余的 ifcfg-ethX 配置如下:
DEVICE=ethX
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
NM_CONTROLLED=no
最后需要把這些加入
echo 'alias bond0 bonding' >> /etc/modprobe.d/bonding.conf
echo 'options bonding mode=0 miimon=100' >> /etc/modprobe.d/bonding.conf
echo 'ifenslave bond0 eth0 eth1' >>/etc/rc.local
否則重啟后 bond0 無法啟動
最后一步:
service network restart