鏈路聚合詳解
- 華為交換機鏈路聚合:
- Linux鏈路聚合bond
- 配置
華為交換機鏈路聚合:
方式一:配置手工負載分擔方式的鏈路聚合
[CORE1] interface Eth-Trunk 1
[CORE1-Eth-Trunk1] trunkport GigabitEthernet 0/0/5 to 0/0/6
[CORE1-Eth-Trunk1] port link-type access
[CORE1-Eth-Trunk1] port default vlan 300
[CORE1-Eth-Trunk1] quit
方式二:配置LACP模式的鏈路聚合
[CORE1] interface Eth-Trunk 1
[CORE1-Eth-Trunk1] mode lacp
[CORE1-Eth-Trunk1] trunkport GigabitEthernet 0/0/5 to 0/0/6
[CORE1-Eth-Trunk1] port link-type access
[CORE1-Eth-Trunk1] port default vlan 300
[CORE1-Eth-Trunk1] quit
# 在CORE1上配置系統(tǒng)優(yōu)先級為100,使其成為LACP主動端[CORE1] lacp priority 100
# 在CORE1上配置活動接口上限閾值為2[CORE1] interface Eth-Trunk 1
[CORE1-Eth-Trunk1] max active-linknumber 2
[CORE1-Eth-Trunk1] quit
# 在CORE1上配置接口優(yōu)先級確定活動鏈路(配置GE0/0/5和GE0/0/6為活動鏈路)[CORE1] interface GigabitEthernet 0/0/5
[CORE1-GigabitEthernet0/0/5] lacp priority 100
[CORE1-GigabitEthernet0/0/5] quit
[CORE1] interface GigabitEthernet 0/0/6
[CORE1-GigabitEthernet0/0/6] lacp priority 100
[CORE1-GigabitEthernet0/0/6] quit
Linux鏈路聚合bond
1、mode=0(balance-rr)(平衡掄循環(huán)策略)2、mode=1(active-backup)(主-備份策略)3、mode=2(balance-xor)(平衡策略,根據(jù)hash策略平衡)4、mode=3(broadcast)(廣播策略,高可靠較浪費資源)5、mode=4(802.3ad)(IEEE 802.3ad 動態(tài)鏈接聚合)6、mode=5(balance-tlb)(適配器傳輸負載均衡)7、mode=6(balance-alb)(適配器適應性負載均衡)
配置
cat /etc/sysconfig/network-scripts/ifcfg-p2p1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=p2p1
DEVICE=p2p1
ONBOOT=yes
MASTER=bond0
SLAVE=yes[root@dev2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-p2p2
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=p2p2
DEVICE=p2p2
ONBOOT=yes
MASTER=bond0
SLAVE=yescat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.1.2
PREFIX=24
GATEWAY=192.168.1.254
ONBOOT=yes
DNS1=8.8.8.8
BOOTPROTO=none
BONDING_OPTS="mode=4 miimon=100"開機自動加載模塊到內(nèi)核
#echo 'alias bond0 bonding' >> /etc/modprobe.d/dist.conf
#echo 'options bonding mode=0 miimon=200' >> /etc/modprobe.d/dist.conf
#echo 'ifenslave bond0 eth0 eth1' >>/etc/rc.local
miimon=100##查看bond0狀態(tài)
cat /proc/net/bonding/bond0