ubuntu版本:Ubuntu 14.04.1 LTS
安装网卡负载软件
aptitudeinstall ifenslave
加载模块及配置负载算法
echo"bonding mode=0 miimon=100" >>/etc/modules
#miimon是100ms监测一次网卡状态
配置bond0
注:bond IP与成员口的IP不能一致,如果不想成员口IP获得本网段地址,可以随便配置一个。
root@Telcom-DG-WY-LVS-13-130:~#cat /etc/network/interfaces
# The loopback networkinterface
auto lo
iface lo inet loopback
autop1p1
iface p1p1 inet static
address 172.16.0.2
netmask 255.255.255.0
auto p1p2
iface p1p2 inet static
address 172.16.1.2
netmask 255.255.255.0
auto bond0
iface bond0 inet static
address 14.17.64.2
netmask 255.255.255.0
gateway 14.17.64.1
dns-nameservers 114.114.114.114
up ifenslave bond0 p1p1 p1p2
down ifenslave -d bond0 p1p1 p1p2
重启服务器
reboot
确认bond状态
root@Telcom-DG-WY-LVS-13-130:~#cat /proc/net/bonding/bond0
Ethernet Channel BondingDriver: v3.7.1 (April 27, 2011)
Bonding Mode: loadbalancing (round-robin)
MII Status: up
MII Polling Interval (ms):100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: p1p1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr:00:25:90:e0:9c:8c
Slave queue ID: 0
Slave Interface: p1p2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr:00:25:90:e0:9c:8d
Slave queue ID: 0
h3c交换机绑定
网卡mode0需要交换机的支持,如果交换机不做绑定,虽然不会影响连通性,但是性能只有单个网卡,这是因为mode0时,服务器两个网卡都是相同的MAC地址,在交换机上无论对应哪一个端口,同一时刻也只有一个端口转发流量,所以需要在交换机上做链路聚合。
配置:
interfaceBridge-Aggregation 2
port access vlan 641
description to_1.1.1.2
quit
interface GigabitEthernet1/0/11
port link-aggregation group 2
quit
interface GigabitEthernet1/0/24
port link-aggregation group 2
quit
dis bri interface #查看接口状态
save #保存配置
本文转自杨云1028 51CTO博客,原文链接:http://blog.51cto.com/yangrong/1576768,如需转载请自行联系原作者