实验拓扑
路由与交换机配置
交换机配置
LSW1
<Huawei>system-view
[Huawei]sysname SW1
[SW1]int vlanif 1
[SW1-Vlanif1]ip add 192.168.10.2 24
[SW1-Vlanif1]q
[SW1]lacp priority 1000 #配置系统LACP优先级
[SW1]int Eth-Trunk 1 # 进入E-Trunk 1 配置
[SW1-Eth-Trunk1]bpdu enable # BPDU桥协议数据单元,是STP生成树协议中的报文,开启主要是防环
[SW1-Eth-Trunk1]mode lacp-static # 静态LACP模式也称为M∶N模式。这种方式同时可以实现链路负载分担和链路冗余备份的双重功能。
[SW1-Eth-Trunk1]max active-linknumber 2 # 最大链路活动数量为2
[SW1-Eth-Trunk1]trunkport Ethernet 0/0/1 to 0/0/3 # 将接口 0/0/1 to 0/0/3加入Eth-Trunk1中
[SW1-Eth-Trunk1]un sh
[SW1-Eth-Trunk1]q
[SW1]int Eth-Trunk 2
[SW1-Eth-Trunk2]trunkport g 0/0/1 to 0/0/2
[SW1-Eth-Trunk2]un sh
[SW1-Eth-Trunk2]q
LSW2
<Huawei>system-view
[Huawei]sysname SW2
[SW2]int vlanif 1
[SW2-Vlanif1]ip add 192.168.10.3 24
[SW2-Vlanif1]q
[SW2]int Eth-Trunk 1
[SW2-Eth-Trunk1]bpdu enable
[SW2-Eth-Trunk1]mode lacp
[SW2-Eth-Trunk1]mode lacp-static
[SW2-Eth-Trunk1]trunkport e 0/0/1 to 0/0/3
[SW2-Eth-Trunk1]max active-linknumber 2
[SW2-Eth-Trunk1]un sh
路由配置
R1
<Huawei>system-view
[Huawei]sysname
[Huawei]sysname R1
[R1]int Eth-Trunk 2
[R1-Eth-Trunk2]ip add 192.168.10.1
[R1-Eth-Trunk2]trunkport g 0/0/0 to 0/0/1
[R1-Eth-Trunk2]q
[R1]int Eth-Trunk 1
[R1-Eth-Trunk1]trunkport GigabitEthernet 0/0/2 to 0/0/3
[R1-Eth-Trunk1]ip add 12.0.0.1 30
[R1-Eth-Trunk1]un sh
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 # 配置静态路由,向上指默认
R2配置
<Huawei>sys
[Huawei]sysname R2
[R2]int Eth-Trunk 5
[R2-Eth-Trunk5]trunkport g 0/0/2 to 0/0/3
[R2-Eth-Trunk5]ip add 12.0.0.2 30
[R2-Eth-Trunk5]un sh
[R2-Eth-Trunk5]q
[R2]ip route-static 192.168.10.0 24 12.0.0.1
[R2]int loo 0
[R2-LoopBack0]ip add 8.8.8.8 0
测通实验
使用PC1 ping R2的虚拟ip8.8.8.8
知识扩展
LACP(Link Aggregation Control Protocol):链路聚合技术的使用,使得逻辑链路的带宽增加了大约(n-1)倍,这里,n为聚合的路数。另外,聚合后,可靠性大大提高,因为,n条链路中只要有一条可以正常工作,则这个链路就可以工作。除此之外,链路聚合可以实现负载均衡。因为,通过链路聚合连接在一起的两个交换机(或其他网络设备),通过内部控制,也可以合理地将数据分配在被聚合连接的设备上,实现负载分担。