WEB开发网
开发学院操作系统Linux/Unix linux下多网卡绑定 阅读

linux下多网卡绑定

 2012-10-10 17:02:57 来源:WEB开发网   
核心提示: 假定将eth0,eth1,eth2,eth3绑定成bond0, 步骤如下:(1) #vi /etc/modprobe.conf, 添加如下2行:alias bond0 bondingoptions bonding miimon=100 mode=4当mode=0时,交换机相应端口不需要做trunk,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@io102 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@io102 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTE=static
ONBOOT=yes
IPADDR=192.*.*.*
NETMASK=255.255.255.0
USERTCL=no
GATEWAY=192.*.*.*
[root@io102 network-scripts]# cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth3
DEVICE=eth3
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
(3)查看bond0的状态
[root@io102 ~]# more /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: slow
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 4
Actor Key: 17
Partner Key: 480
Partner Mac Address: 00:12:f2:cd:68:00
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:73:56:26
Aggregator ID: 1
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:73:56:a2
Aggregator ID: 1
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:d5:34:d2
Aggregator ID: 1
Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:d5:34:d0
Aggregator ID: 1
然后在交换机(这里的交换机是Foundry)端做TRUNK
将同一台服务器的多个网卡捆绑成一条逻辑的线路来使用,提高服务器与交换机之间的带宽,并且能够负载均衡多个网卡上的流量,以及多个网卡之间的冗余当其中一个网卡坏了其它的网卡会平分坏网卡上的流量 ,并不影响服务器与交换机之间的数据转发。注 如果交换机配置为trunk 那么服务器段也要做相应的配置 trunk 才能被正确的使用

1 2  下一页

Tags:linux 网卡 绑定

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接