Linux下多网卡绑定

假定将eth0,eth1,eth2,eth3绑定成bond0, 步骤如下:

(1) #vi /etc/modprobe.conf, 添加如下2行:

alias bond0 bonding

options bonding miimon=100 mode=4

当mode=0时,交换机相应端口不需要做trunk,但是从节点上ping网关(192.*.*.*)有较大的延时。解决此问题的办法是把mode改成4,同时配置交换机相应端口开启链路聚合并捆绑为trunk。

在modprobe.conf文件中,

miimon参数用来监测网卡物理连接,建议至少设为100

mode参数用来设置绑定模式

0 负载均衡(round robin策略)

1 active/backup模式,同一时间只有一块网卡使用。

2 负载均衡(xor算法)

3 广播模式

4 802.3ad模式,lagp协议,带宽翻倍。

模式不能写错

这里很容易出现不稳定的情况,多半是这里模式选择错了,所以在实施的时候需要小心,,把模式确定了,然后在动手。

(2)修改/etc/sysconfig/network-scripts/目录下的ifcfg-bond0,ifcfg-eth0,ifcfg-eth1,ifcfg-eth2,ifcfg-eth3.具体内容如下:[root@io102network-scripts]#pwd/etc/sysconfig/network-scripts[root@io102network-scripts]#catifcfg-bond0DEVICE=bond0BOOTPROTE=staticONBOOT=yesIPADDR=192.*.*.*NETMASK=255.255.255.0USERTCL=noGATEWAY=192.*.*.*[root@io102network-scripts]#catifcfg-eth0DEVICE=eth0BOOTPROTO=noneONBOOT=yesTYPE=EthernetUSERTCL=noMASTER=bond0SLAVE=yes[root@io102network-scripts]#catifcfg-eth1DEVICE=eth1BOOTPROTO=noneONBOOT=yesTYPE=EthernetUSERTCL=noMASTER=bond0SLAVE=yes[root@io102network-scripts]#catifcfg-eth2DEVICE=eth2BOOTPROTO=noneONBOOT=yesTYPE=EthernetUSERTCL=noMASTER=bond0SLAVE=yes[root@io102network-scripts]#catifcfg-eth3DEVICE=eth3BOOTPROTO=noneONBOOT=yesTYPE=EthernetUSERTCL=noMASTER=bond0SLAVE=yes

留下许多叫知识和情感的东西握在手里。

Linux下多网卡绑定

相关文章:

你感兴趣的文章:

标签云: