1 端口隔离 综合案例
1.1 问题
1)PC1/2/3/4 都属于同一个 VLAN 100
2)IP 地址所在网段为 192.168.100.0/24,网关地址为 192.168.100.254
3)PC1/2 不能互相访问,但是都可以访问 PC3/4
4)同时,所有的 PC 都可以访问 Server1
1.2 方案
使用 eNSP 搭建实验环境,如图 - 1 所示。

图 - 1
1.3 步骤
实现此案例需要按照如下步骤进行。
1)如图配置 PC 、R1、Server1 的 IP 地址和网关
2)在 SW1 上配置端口隔离
1. vlan 1002. quit4. port-group group-member gi0/0/1 to gi0/0/55. port link access6. port default vlan 1007. quit9. port-group group-member gi0/0/1 gi0/0/210. port-isolate enable group 1 -> 开启端口隔离,并加入组111. quit
3)测试 PC 与 Server1 之间的连通性
2 配置静态路由
2.1 问题
1)如图互联设备,配置接口 IP 地址
2)配置静态路由,确保 PC 之间互通
2.2 方案
使用 eNSP 搭建实验环境,如图 - 2 所示。
/
图 - 2
2.3 步骤
实现此案例需要按照如下步骤进行。
1)如图配置 PC 、R1、Server1 的 IP 地址和网关
2)在 R1/R2 上配置去往对端 PC 的静态路由
1. \[R1\]ip route-static 192.168.4.0 24 192.168.2.22. \[R2\]ip route-static 1921.68.1.0 24 192.168.2.1
3)测试 PC1 与 PC2 之间的连通性
3 配置默认路由
3.1 问题
配置设备的接口 IP 地址,并通过配置静态路由和默认路由,实现全网设备互通
3.2 方案
使用 eNSP 搭建实验环境,如图 - 3 所示。

图 - 3
3.3 步骤
实现此案例需要按照如下步骤进行。
- 配置 PC 的 IP 地址和网关
- 保持交换机 SW1/2 的默认配置不变
- 配置 R1/R2/R3 的接口 IP 地址
- 配置 R1/R2/R3 的路由条目
1. \[R1\] ip route-static 0.0.0.0 0 192.168.2.22. \[R2\] ip route-static 192.168.1.0 24 192.168.2.13. \[R2\] ip route-static 192.168.4.0 24 192.168.3.24. \[R3\] ip route-static 0.0.0.0 0 192.168.3.1
- 测试 PC1 和 PC2 之间的连通性
4 VLAN 间通信之单臂路由
4.1 问题
1)如图配置 PC 和路由器的接口 IP 地址
2)在 R1 上配置单臂路由,实现 PC1/2 之间的互通
4.2 方案
使用 eNSP 搭建实验环境,如图 - 4 所示。

图 - 4
4.3 步骤
实现此案例需要按照如下步骤进行。
步骤一:配置交换机
1. \[SW1\]vlan batch 10 203. \[SW1\]interface eth0/0/14. \[SW1-Ethernet0/0/1\]port link-type access5. \[SW1-Ethernet0/0/1\]port default vlan 107. \[SW1\]interface eth0/0/28. \[SW1-Ethernet0/0/2\]port link-type access9. \[SW1-Ethernet0/0/2\]port default vlan 2011. \[SW1\]interface g0/0/112. \[Huawei-GigabitEthernet0/0/1\]port link-type trunk13. \[Huawei-GigabitEthernet0/0/1\]port trunk allow-pass vlan 10 20
步骤二:配置路由器
1. \[R1\]interface g0/0/1.12. \[R1-GigabitEthernet0/0/1.1\]dot1q termination vid 103. \[R1-GigabitEthernet0/0/1.1\]ip address 10.10.0.1 244. \[R1-GigabitEthernet0/0/1.1\]arp broadcast enable6. \[R1\]interface g0/0/1.27. \[R1-GigabitEthernet0/0/1.2\]dot1q termination vid 208. \[R1-GigabitEthernet0/0/1.2\]ip address 10.20.0.1 249. \[R1-GigabitEthernet0/0/1.2\]arp broadcast enable
步骤三:测试
使用 ping 命令测试,如图 - 4 所示。

图 - 4
5 路由网综合案例
5.1 问题
1)如图配置不同 PC 的 IP 地址和网关
2)每个 VLAN 的 IP 地址为 192.168.XX.0/24(XX 为 vlan 号)
3)每个 VLAN 内的主机的网关 IP 地址为 192.168.XX.254,XX 为 vlan 号
4)确保不同网段的 PC 是可以互通的
5.2 方案
使用 eNSP 搭建实验环境,如图 - 6 所示。

图 - 6
5.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 PC 的 IP 地址和网关
2) 配置 SW1/5/6 的 vlan 为 10/20/30,交换机之间的链路为 Trunk,与 PC 间为 Access
3)配置 SW2/3/7 的 vlan 为 40/50,交换机之间的链路为 Trunk,与 PC 间为 Access
4) 配置 SW4/8/9 的 vlan 为 60/70/80,交换机之间的链路为 Trunk,与 PC 间为 Access
5)配置 R1/R2/R3 的接口 IP 地址
6)配置每个 VLAN 的网关接口 IP 地址
1. SW1为vlan10/20/30的网关设备:2. interface vlanif 103. ip address 192.168.10.254 244. quit5. interface vlanif 206. ip address 192.168.20.254 247. quit8. interface vlanif 309. ip address 192.168.30.254 2410. quit12. SW2为 vlan 40 的网关:13. interface vlanif 4014. ip address 192.168.40.254 2415. quit17. SW3为 vlan 50 的网关:18. interface vlanif 5019. ip address 192.168.50.254 2420. quit22. R3的 gi0/0/0为 vlan60/70/80 的网关:23. interface gi0/0/0.6024. dot1q termination vid 6025. arp broadcast enable26. ip address 1921.68.60.254 2427. quit29. interface gi0/0/0.7030. dot1q termination vid 7031. arp broadcast enable32. ip address 1921.68.70.254 2433. quit35. interface gi0/0/0.8036. dot1q termination vid 8037. arp broadcast enable38. ip address 1921.68.80.254 2439. quit
7)在 SW1 与 R1 之间添加 vlan 100,实现两者互通
1. SW1:2. vlan 1003. quit5. interface gi0/0/16. port link-type access7. port default vlan 1008. quit10. interface vlanif 10011. ip address 192.168.100.100 2412. quit14. ip route-static 0.0.0.0 0 192.168.100.116. R1:17. interface gi0/0/018. ip address 192.168.100.1 2419. quit21. ip route-static 192.168.10.0 24 192.168.100.10022. ip route-static 192.168.20.0 24 192.168.100.10023. ip route-static 192.168.30.0 24 192.168.100.10024. ip route-static 192.168.40.0 24 192.168.12.225. ip route-static 192.168.50.0 24 192.168.12.226. ip route-static 192.168.60.0 24 192.168.12.227. ip route-static 192.168.70.0 24 192.168.12.228. ip route-static 192.168.80.0 24 192.168.12.2
8)在 SW2 与 R2 之间添加 vlan 400,实现两者互通
1. SW2:2. vlan 4003. quit5. interface gi0/0/16. port link-type access7. port default vlan 4008. quit10. interface vlanif 40011. ip address 192.168.200.3 2412. quit14. ip route-static 0.0.0.0 0 192.168.200.216. R2:17. interface gi0/0/018. ip address 192.168.200.2 2419. quit21. ip route-static 192.168.40.0 24 192.168.200.3
9)在 SW3 与 R2 之间添加 vlan 500,实现两者互通
1. SW3:2. vlan 5003. quit5. interface gi0/0/16. port link-type access7. port default vlan 5008. quit10. interface vlanif 50011. ip address 192.168.255.3 2412. quit14. ip route-static 0.0.0.0 0 192.168.255.216. R2:17. interface gi4/0/018. ip address 192.168.255.2 2419. quit21. ip route-static 192.168.50.0 24 192.168.255.322. ip route-static 192.168.10.0 24 192.168.12.123. ip route-static 192.168.20.0 24 192.168.12.124. ip route-static 192.168.30.0 24 192.168.12.125. ip route-static 192.168.60.0 24 192.168.23.326. ip route-static 192.168.70.0 24 192.168.23.327. ip route-static 192.168.80.0 24 192.168.23.3
10)在 R3 上配置路由条目信息,实现与其他 PC 所在的网段的互通
1. ip route-static 192.168.10.0 24 192.168.23.22. ip route-static 192.168.20.0 24 192.168.23.23. ip route-static 192.168.30.0 24 192.168.23.24. ip route-static 192.168.40.0 24 192.168.23.25. ip route-static 192.168.50.0 24 192.168.23.26. ip route-static 192.168.60.0 24 192.168.23.2
11)测试不同网段的 PC 之间的连通性
https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNA/DAY03/CASE/01/index.html
