1. 手工链路聚合


1.1 实验拓扑

image.png

1.2 实验要求

  • 让两边同VLAN的主机可以互相通信,为了实现冗余和增加带宽,在LSW1和LSW2之间做手工链路聚合。

1.3 实验配置

  1. [LSW1]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  2. [LSW2]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  3. [LSW3]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  4. [LSW4]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  5. [LSW5]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  6. [LSW6]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  1. 将对应的端口划入对应的VLAN
  2. [LSW3]int Ethernet0/0/2 //进入E0/0/2端口
  3. [LSW3-Ethernet0/0/2]port link-type access //将端口类型改为Access
  4. [LSW3-Ethernet0/0/2]port default vlan 10 //将端口划入VLAN 10中
  5. [LSW4]int Ethernet0/0/2 //进入E0/0/2端口
  6. [LSW4-Ethernet0/0/2]port link-type access //将端口类型改为Access
  7. [LSW4-Ethernet0/0/2]port default vlan 20 //将端口划入VLAN 20中
  8. [LSW5]int Ethernet0/0/2 //进入E0/0/2端口
  9. [LSW5-Ethernet0/0/2]port link-type access //将端口类型改为Access
  10. [LSW5-Ethernet0/0/2]port default vlan 10 //将端口划入VLAN 10中
  11. [LSW6]int Ethernet0/0/2 //进入E0/0/2端口
  12. [LSW6-Ethernet0/0/2]port link-type access //将端口类型改为Access
  13. [LSW6-Ethernet0/0/2]port default vlan 20 //将端口划入VLAN 20中
  1. 将交换机互联链路配置为Trunk
  2. [LSW3]int Ethernet0/0/1 //进入E0/0/1端口
  3. [LSW3-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  4. [LSW3-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  5. [LSW4]int Ethernet0/0/1 //进入E0/0/1端口
  6. [LSW4-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  7. [LSW4-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  8. [LSW5]int Ethernet0/0/1 //进入E0/0/1端口
  9. [LSW5-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  10. [LSW5-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  11. [LSW6]int Ethernet0/0/1 //进入E0/0/1端口
  12. [LSW6-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  13. [LSW6-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  14. [LSW1]int GigabitEthernet 0/0/1 //进入G0/0/1端口
  15. [LSW1-GigabitEthernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  16. [LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  17. [LSW1]int GigabitEthernet 0/0/2 //进入G0/0/2端口
  18. [LSW1-GigabitEthernet0/0/2]port link-type trunk //将端口类型修改为Trunk
  19. [LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  20. [LSW2]int GigabitEthernet 0/0/1 //进入G0/0/1端口
  21. [LSW2-GigabitEthernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  22. [LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  23. [LSW2]int GigabitEthernet 0/0/2 //进入G0/0/2端口
  24. [LSW2-GigabitEthernet0/0/2]port link-type trunk //将端口类型修改为Trunk
  25. [LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  1. 手工链路聚合配置
  2. [LSW1]int Eth-Trunk 1 //创建聚合组1
  3. [LSW1-Eth-Trunk1]mode manual load-balance //模式修改为手工负载分担
  4. [LSW1-Eth-Trunk1]load-balance ? //可以设置负载分担方式
  5. dst-ip According to destination IP hash arithmetic
  6. dst-mac According to destination MAC hash arithmetic
  7. src-dst-ip According to source/destination IP hash arithmetic
  8. src-dst-mac According to source/destination MAC hash arithmetic
  9. src-ip According to source IP hash arithmetic
  10. src-mac According to source MAC hash arithmetic
  11. [LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/23 //将G0/0/23加入聚合组
  12. [LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/24 //将G0/0/24加入聚合组
  13. [LSW1-Eth-Trunk1]port link-type trunk //将聚合组改为Trunk
  14. [LSW1-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许VLAN 10 20的VLAN帧通过
  15. [LSW2]int Eth-Trunk 1 //创建聚合组1
  16. [LSW2-Eth-Trunk1]mode manual load-balance //模式修改为手工负载分担
  17. [LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/23 //将G0/0/23加入聚合组
  18. [LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/24 //将G0/0/24加入聚合组
  19. [LSW2-Eth-Trunk1]port link-type trunk //将聚合组改为Trunk
  20. [LSW2-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许VLAN 10 20的VLAN帧通过

1.4 实验结果

PC1访问PC3
image.png
PC2访问PC4
image.png

2. LACP链路聚合


2.1 实验拓扑

image.png

2.2 实验要求

  • 让两边同VLAN的主机可以互相通信,为了实现冗余和增加带宽,在LSW1和LSW2之间做LACP模式链路聚合。

2.3 实验配置

  1. [LSW1]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  2. [LSW2]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  3. [LSW3]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  4. [LSW4]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  5. [LSW5]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  6. [LSW6]vlan batch 10 20 //在所有交换机上创建VLAN10和20
  1. 将对应的端口划入对应的VLAN
  2. [LSW3]int Ethernet0/0/2 //进入E0/0/2端口
  3. [LSW3-Ethernet0/0/2]port link-type access //将端口类型改为Access
  4. [LSW3-Ethernet0/0/2]port default vlan 10 //将端口划入VLAN 10中
  5. [LSW4]int Ethernet0/0/2 //进入E0/0/2端口
  6. [LSW4-Ethernet0/0/2]port link-type access //将端口类型改为Access
  7. [LSW4-Ethernet0/0/2]port default vlan 20 //将端口划入VLAN 20中
  8. [LSW5]int Ethernet0/0/2 //进入E0/0/2端口
  9. [LSW5-Ethernet0/0/2]port link-type access //将端口类型改为Access
  10. [LSW5-Ethernet0/0/2]port default vlan 10 //将端口划入VLAN 10中
  11. [LSW6]int Ethernet0/0/2 //进入E0/0/2端口
  12. [LSW6-Ethernet0/0/2]port link-type access //将端口类型改为Access
  13. [LSW6-Ethernet0/0/2]port default vlan 20 //将端口划入VLAN 20中
  1. 将交换机互联链路配置为Trunk
  2. [LSW3]int Ethernet0/0/1 //进入E0/0/1端口
  3. [LSW3-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  4. [LSW3-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  5. [LSW4]int Ethernet0/0/1 //进入E0/0/1端口
  6. [LSW4-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  7. [LSW4-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  8. [LSW5]int Ethernet0/0/1 //进入E0/0/1端口
  9. [LSW5-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  10. [LSW5-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  11. [LSW6]int Ethernet0/0/1 //进入E0/0/1端口
  12. [LSW6-Ethernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  13. [LSW6-Ethernet0/0/1]port trunk allow-pass vlan 10 20 //Trunk链路允许VLAN10 20的VLAN帧通过
  14. [LSW1]int GigabitEthernet 0/0/1 //进入G0/0/1端口
  15. [LSW1-GigabitEthernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  16. [LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  17. [LSW1]int GigabitEthernet 0/0/2 //进入G0/0/2端口
  18. [LSW1-GigabitEthernet0/0/2]port link-type trunk //将端口类型修改为Trunk
  19. [LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  20. [LSW2]int GigabitEthernet 0/0/1 //进入G0/0/1端口
  21. [LSW2-GigabitEthernet0/0/1]port link-type trunk //将端口类型修改为Trunk
  22. [LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  23. [LSW2]int GigabitEthernet 0/0/2 //进入G0/0/2端口
  24. [LSW2-GigabitEthernet0/0/2]port link-type trunk //将端口类型修改为Trunk
  25. [LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 //允许VLAN10 20的VLAN帧通过
  1. LACP链路聚合配置
  2. [LSW1]int Eth-Trunk 1 //创建聚合组1
  3. [LSW1-Eth-Trunk1]mode lacp-static //模式修改为静态LACP
  4. [LSW1-Eth-Trunk1]load-balance ? //可以设置负载分担方式
  5. dst-ip According to destination IP hash arithmetic
  6. dst-mac According to destination MAC hash arithmetic
  7. src-dst-ip According to source/destination IP hash arithmetic
  8. src-dst-mac According to source/destination MAC hash arithmetic
  9. src-ip According to source IP hash arithmetic
  10. src-mac According to source MAC hash arithmetic
  11. [LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/23 //将G0/0/23加入聚合组
  12. [LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/24 //将G0/0/24加入聚合组
  13. [LSW1-Eth-Trunk1]port link-type trunk //将聚合组改为Trunk
  14. [LSW1-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许VLAN 10 20的VLAN帧通过
  15. [LSW2]int Eth-Trunk 1 //创建聚合组1
  16. [LSW1-Eth-Trunk1]mode lacp-static //模式修改为静态LACP
  17. [LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/23 //将G0/0/23加入聚合组
  18. [LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/24 //将G0/0/24加入聚合组
  19. [LSW2-Eth-Trunk1]port link-type trunk //将聚合组改为Trunk
  20. [LSW2-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许VLAN 10 20的VLAN帧通过
  21. [LSW1-Eth-Trunk1]lacp preempt ? //配置LACP抢占
  22. delay Delay time of preemption //配置抢占延时
  23. enable Enable preemption //开启抢占
  24. [LSW1-Eth-Trunk1]lacp selected priority //配置自己为主

2.4 实验结果

image.png
image.png

PC1访问PC3
image.png
PC2访问PC4
image.png