1 STP 选路案例
1.1 问题
1)PC1 和 PC6 属于 vlan 16,网段为:192.168.16.0/24
2)PC2 和 PC5 属于 vlan 25,网段为:192.168.25.0/24
3)PC3 和 PC4 属于 vlan 34,网段为:192.168.34.0/24
4)确保同网段的设备之间,通信路径是最优的
1.2 方案
使用 eNSP 搭建实验环境,如图 - 1 所示。

图 - 1
1.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 PC1/2/3/4/5/6 的 IP 地址
2)在 A/B/C/D 上配置基本信息
- 创建 VLAN 16、25、34,确保每个交换机的 VLAN 相同
- 配置交换机之间的链路为 Trunk,并允许所有的 VLAN 通过
- 配置交换机与 PC 之间的链路为 Access,并加入到正确的 VLAN
3)配置 MSTP(A/B/C/D 配置相同)
1. stp mode mstp2. stp region-configuration3. region-name Tedu4. instance 16 vlan 165. instance 25 vlan 256. instance 34 vlan 347. active region-configuration
4)配置每个实例的根交换机
1. \[A\]:stp instance 16 priority 02. \[B\]:stp instance 34 priority 03. \[C\]:stp instance 25 priority 0
2 配置静态 Eth-trunk
2.1 问题
1)交换网络中存在 2 个 VLAN – 10 和 20
2)每个 VLAN 的 IP 地址为:192.168.xx.0/24(xx 为 vlan 号)
3)对交换机之间的链路进行链路捆绑,增加互联带宽
4)确保同 VLAN 的 PC 之间互通
2.2 方案
使用 eNSP 搭建实验环境,如图 - 2 所示。

图 - 2
2.3 步骤
实现此案例需要按照如下步骤进行。
1)如图配置 PC 的 IP 地址
2)在 SW1/2 配置基本信息
- 创建 vlan 10 和 20
- 配置交换机与 PC 之间的链路为 Access,并加入到正确的 VLAN
3)对 SW1/2 之间的链路进行链路捆绑
1. \[SW1\]interface eth-trunk 12. \[SW1-Eth-Trunk1\]mode manual load-balance3. \[SW1-Eth-Trunk1\]trunkport g0/0/14. \[SW1-Eth-Trunk1\]trunkport g0/0/25. \[SW1-Eth-Trunk1\]quit7. \[SW2\]interface eth-trunk 18. \[SW2-Eth-Trunk1\]mode manual load-balance9. \[SW2-Eth-Trunk1\]trunkport g0/0/110. \[SW2-Eth-Trunk1\]trunkport g0/0/211. \[SW2-Eth-Trunk1\]quit
4)显示 Eth-Trunk 信息,如图 - 3 所示

图 - 3
5)把 Eth-trunk 配置为 Trunk(SW2 的配置与 SW1 相同)
1. \[SW1\]interface eth-trunk 12. \[SW1-Eth-Trunk1\]port link-type trunk3. \[SW1-Eth-Trunk1\]port trunk allow-pass vlan all4. \[SW1-Eth-Trunk1\]quit
3 配置动态 Eth-trunk
3.1 问题
1)交换机之间的多个链路通过 LACP 协议自动捆绑
2)配置 SW2 为 LACP 的主动端,优先级设置为 100、
3)交换机之间的最大连接带宽为 2G
3.2 方案
使用 eNSP 搭建实验环境,如图 - 4 所示。

图 - 4
3.3 步骤
实现此案例需要按照如下步骤进行。
1)如图配置 PC 的接口 IP 地址
2)在 SW1/2 上配置基本信息
- 创建 vlan 10 和 20
- 配置交换机与 PC 之间的链路为 Access,并加入到正确的 VLAN
3)对 SW1/2 之间的链路进行捆绑
1. \[SW1\]interface eth-trunk 12. \[SW1-Eth-Trunk1\]mode lacp-static3. \[SW1-Eth-Trunk1\]trunkport g0/0/14. \[SW1-Eth-Trunk1\]trunkport g0/0/25. \[SW1-Eth-Trunk1\]trunkport g0/0/3
4)配置 SW2 eth-trunk 的主动端,优先级为 100
5)配置最大带宽为 2G,并开启 LACP 的抢占功能 (SW1/2 都要配置)
1. \[SW2\]interface eth-trunk 12. \[sw2-Eth-Trunk1\]max active-linknumber 23. \[sw2-Eth-Trunk1\]lacp preempt enable
6)把 Eth-trunk 配置为 Trunk(SW1/2 都要配置)
1. \[SW2\]interface eth-trunk 12. \[SW2-Eth-Trunk1\]port link-type trunk3. \[SW2-Eth-Trunk1\]port trunk allow-pass vlan all4. \[SW2-Eth-Trunk1\]quit
4 链路聚合综合实战
4.1 问题
1)PC1 和 PC3 属于 vlan 10,PC3 和 PC4 属于 vlan 20
3)确保设备之间的互联链路使用最大的互联带宽,并且没有环路发生
4)确保相同 vlan 之间的主机可以互相访问
4.2 方案
使用 eNSP 搭建实验环境,如图 - 5 所示。

图 - 5
4.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 sw3
创建 vlan 和一个链路聚合端口
Sw3:
1. \[sw3\]Vlan batch 10 202. \[sw3\]interface e0/0/13. \[sw3-Ethernet0/0/1\]port link-type access4. \[sw3-Ethernet0/0/1\]port default vlan 105. \[sw3-Ethernet0/0/1\]quit6. \[sw3\]interface eth-trunk 17. \[sw3-Eth-Trunk1\]mode lacp-static8. \[sw3-Eth-Trunk1\]trunkport e0/0/39. \[sw3-Eth-Trunk1\]trunkport e0/0/410. \[sw3-Eth-Trunk1\]port link-type trunk11. \[sw3-Eth-Trunk1\]port trunk allow-pass vlan all12. \[sw3-Eth-Trunk1\]quit
2)配置 sw4
创建 vlan 和一个链路聚合端口
Sw4:
1. \[sw4\]Vlan batch 10 202. \[sw4\]interface e0/0/13. \[sw4-Ethernet0/0/1\]port link-type access4. \[sw4-Ethernet0/0/1\]port default vlan 205. \[sw4-Ethernet0/0/1\]quit6. \[sw4\]interface eth-trunk 17. \[sw4-Eth-Trunk1\]mode lacp-static8. \[sw4-Eth-Trunk1\]trunkport e0/0/39. \[sw4-Eth-Trunk1\]trunkport e0/0/410. \[sw4-Eth-Trunk1\]port link-type trunk11. \[sw4-Eth-Trunk1\]port trunk allow-pass vlan all12. \[sw4-Eth-Trunk1\]quit
3)配置 sw5
创建 vlan 和一个链路聚合端口
Sw5:
1. \[sw5\]Vlan batch 10 202. \[sw5\]interface e0/0/13. \[sw5-Ethernet0/0/1\]port link-type access4. \[sw5-Ethernet0/0/1\]port default vlan 105. \[sw5-Ethernet0/0/1\]quit6. \[sw5\]interface eth-trunk 17. \[sw5-Eth-Trunk1\]mode lacp-static8. \[sw5-Eth-Trunk1\]trunkport e0/0/39. \[sw5-Eth-Trunk1\]trunkport e0/0/410. \[sw5-Eth-Trunk1\]port link-type trunk11. \[sw5-Eth-Trunk1\]port trunk allow-pass vlan all12. \[sw5-Eth-Trunk1\]quit
4)配置 sw6
创建 vlan 和一个链路聚合端口
Sw6:
1. \[sw6\]Vlan batch 10 202. \[sw6\]interface e0/0/13. \[sw6-Ethernet0/0/1\]port link-type access4. \[sw6-Ethernet0/0/1\]port default vlan 205. \[sw6-Ethernet0/0/1\]quit6. \[sw6\]interface eth-trunk 17. \[sw6-Eth-Trunk1\]mode lacp-static8. \[sw6-Eth-Trunk1\]trunkport e0/0/39. \[sw6-Eth-Trunk1\]trunkport e0/0/410. \[sw6-Eth-Trunk1\]port link-type trunk11. \[sw6-Eth-Trunk1\]port trunk allow-pass vlan all12. \[sw6-Eth-Trunk1\]quit
5)配置 sw1
创建 vlan 和三个链路聚合端口
Sw1:
1. \[sw1\]Vlan batch 10 202. \[sw1\]interface eth-trunk 13. \[sw1-Eth-Trunk1\]mode lacp-static4. \[sw1-Eth-Trunk1\]trunkport gi0/0/35. \[sw1-Eth-Trunk1\]trunkport gi0/0/46. \[sw1-Eth-Trunk1\]port link-type trunk7. \[sw1-Eth-Trunk1\]port trunk allow-pass vlan all8. \[sw1-Eth-Trunk1\]quit9. \[sw1\]interface eth-trunk 210. \[sw1-Eth-Trunk2\]mode lacp-static11. \[sw1-Eth-Trunk2\]trunkport gi0/0/512. \[sw1-Eth-Trunk2\]trunkport gi0/0/613. \[sw1-Eth-Trunk2\]port link-type trunk14. \[sw1-Eth-Trunk2\]port trunk allow-pass vlan all15. \[sw1-Eth-Trunk2\]quit16. \[sw1\]interface eth-trunk 317. \[sw1-Eth-Trunk3\]mode lacp-static18. \[sw1-Eth-Trunk3\]trunkport gi0/0/719. \[sw1-Eth-Trunk3\]trunkport gi0/0/820. \[sw1-Eth-Trunk3\]port link-type trunk21. \[sw1-Eth-Trunk3\]port trunk allow-pass vlan all22. \[sw1-Eth-Trunk3\]quit
6)配置 sw2
创建 vlan 和三个链路聚合端口
Sw1:
1. \[sw2\]Vlan batch 10 202. \[sw2\]interface eth-trunk 13. \[sw2-Eth-Trunk1\]mode lacp-static4. \[sw2-Eth-Trunk1\]trunkport gi0/0/35. \[sw2-Eth-Trunk1\]trunkport gi0/0/46. \[sw2-Eth-Trunk1\]port link-type trunk7. \[sw2-Eth-Trunk1\]port trunk allow-pass vlan all8. \[sw2-Eth-Trunk1\]quit9. \[sw2\]interface eth-trunk 210. \[sw2-Eth-Trunk2\]mode lacp-static11. \[sw2-Eth-Trunk2\]trunkport gi0/0/512. \[sw2-Eth-Trunk2\]trunkport gi0/0/613. \[sw2-Eth-Trunk2\]port link-type trunk14. \[sw2-Eth-Trunk2\]port trunk allow-pass vlan all15. \[sw2-Eth-Trunk2\]quit16. \[sw2\]interface eth-trunk 317. \[sw2-Eth-Trunk3\]mode lacp-static18. \[sw2-Eth-Trunk3\]trunkport gi0/0/719. \[sw2-Eth-Trunk3\]trunkport gi0/0/820. \[sw2-Eth-Trunk3\]port link-type trunk21. \[sw2-Eth-Trunk3\]port trunk allow-pass vlan all22. \[sw2-Eth-Trunk3\]quit
4)为所有 PC 机配置相应的 IP 地址
5)测试 PC 之间的互通性
5 Mux Vlan 综合案例
5.1 问题
1)VLAN 100 是主 vlan ,vlan 200 和 300 是辅助 vlan
2)VLAN 200 是隔离 vlan, VLAN 300 是组 vlan
3)PC1/2 属于 vlan 200,PC3/4 属于 vlan 300
4)确保 PC1/2 与 PC3/4 不能互相访问,但是都可以访问 Server1
5)配置每个设备的 IP 地址,如图所示
5.2 方案
使用 eNSP 搭建实验环境,如图 - 6 所示。

图 - 6
5.3 步骤
实现此案例需要按照如下步骤进行。
1)如图配置 PC 、Server1 和 R1 的接口 IP 地址
2)配置 SW1 的 Mux Vlan 功能
1. SW1:2. vlan batch 100 200 3004. vlan 1005. mux-vlan6. subordinate group 3007. subordinate separate 2008. quit10. port-group group-member gi0/0/1 gi0/0/211. port link-type access12. port default vlan 20013. port mux-vlan enable14. quit16. port-group group-member gi0/0/3 gi0/0/417. port link-type access18. port default vlan 30019. port mux-vlan enable20. quit22. interface gi0/0/1023. port link access24. port default vlan 10025. port mux-vlan enable26. quit
3)测试 PC 与 Server1 之间的通信
https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNA/DAY02/CASE/01/index.html
