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 100
2. quit
4. port-group group-member gi0/0/1 to gi0/0/5
5. port link access
6. port default vlan 100
7. quit
9. port-group group-member gi0/0/1 gi0/0/2
10. port-isolate enable group 1 -> 开启端口隔离,并加入组1
11. 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.2
2. \[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.2
2. \[R2\] ip route-static 192.168.1.0 24 192.168.2.1
3. \[R2\] ip route-static 192.168.4.0 24 192.168.3.2
4. \[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 20
3. \[SW1\]interface eth0/0/1
4. \[SW1-Ethernet0/0/1\]port link-type access
5. \[SW1-Ethernet0/0/1\]port default vlan 10
7. \[SW1\]interface eth0/0/2
8. \[SW1-Ethernet0/0/2\]port link-type access
9. \[SW1-Ethernet0/0/2\]port default vlan 20
11. \[SW1\]interface g0/0/1
12. \[Huawei-GigabitEthernet0/0/1\]port link-type trunk
13. \[Huawei-GigabitEthernet0/0/1\]port trunk allow-pass vlan 10 20
步骤二:配置路由器
1. \[R1\]interface g0/0/1.1
2. \[R1-GigabitEthernet0/0/1.1\]dot1q termination vid 10
3. \[R1-GigabitEthernet0/0/1.1\]ip address 10.10.0.1 24
4. \[R1-GigabitEthernet0/0/1.1\]arp broadcast enable
6. \[R1\]interface g0/0/1.2
7. \[R1-GigabitEthernet0/0/1.2\]dot1q termination vid 20
8. \[R1-GigabitEthernet0/0/1.2\]ip address 10.20.0.1 24
9. \[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 10
3. ip address 192.168.10.254 24
4. quit
5. interface vlanif 20
6. ip address 192.168.20.254 24
7. quit
8. interface vlanif 30
9. ip address 192.168.30.254 24
10. quit
12. SW2为 vlan 40 的网关:
13. interface vlanif 40
14. ip address 192.168.40.254 24
15. quit
17. SW3为 vlan 50 的网关:
18. interface vlanif 50
19. ip address 192.168.50.254 24
20. quit
22. R3的 gi0/0/0为 vlan60/70/80 的网关:
23. interface gi0/0/0.60
24. dot1q termination vid 60
25. arp broadcast enable
26. ip address 1921.68.60.254 24
27. quit
29. interface gi0/0/0.70
30. dot1q termination vid 70
31. arp broadcast enable
32. ip address 1921.68.70.254 24
33. quit
35. interface gi0/0/0.80
36. dot1q termination vid 80
37. arp broadcast enable
38. ip address 1921.68.80.254 24
39. quit
7)在 SW1 与 R1 之间添加 vlan 100,实现两者互通
1. SW1:
2. vlan 100
3. quit
5. interface gi0/0/1
6. port link-type access
7. port default vlan 100
8. quit
10. interface vlanif 100
11. ip address 192.168.100.100 24
12. quit
14. ip route-static 0.0.0.0 0 192.168.100.1
16. R1:
17. interface gi0/0/0
18. ip address 192.168.100.1 24
19. quit
21. ip route-static 192.168.10.0 24 192.168.100.100
22. ip route-static 192.168.20.0 24 192.168.100.100
23. ip route-static 192.168.30.0 24 192.168.100.100
24. ip route-static 192.168.40.0 24 192.168.12.2
25. ip route-static 192.168.50.0 24 192.168.12.2
26. ip route-static 192.168.60.0 24 192.168.12.2
27. ip route-static 192.168.70.0 24 192.168.12.2
28. ip route-static 192.168.80.0 24 192.168.12.2
8)在 SW2 与 R2 之间添加 vlan 400,实现两者互通
1. SW2:
2. vlan 400
3. quit
5. interface gi0/0/1
6. port link-type access
7. port default vlan 400
8. quit
10. interface vlanif 400
11. ip address 192.168.200.3 24
12. quit
14. ip route-static 0.0.0.0 0 192.168.200.2
16. R2:
17. interface gi0/0/0
18. ip address 192.168.200.2 24
19. quit
21. ip route-static 192.168.40.0 24 192.168.200.3
9)在 SW3 与 R2 之间添加 vlan 500,实现两者互通
1. SW3:
2. vlan 500
3. quit
5. interface gi0/0/1
6. port link-type access
7. port default vlan 500
8. quit
10. interface vlanif 500
11. ip address 192.168.255.3 24
12. quit
14. ip route-static 0.0.0.0 0 192.168.255.2
16. R2:
17. interface gi4/0/0
18. ip address 192.168.255.2 24
19. quit
21. ip route-static 192.168.50.0 24 192.168.255.3
22. ip route-static 192.168.10.0 24 192.168.12.1
23. ip route-static 192.168.20.0 24 192.168.12.1
24. ip route-static 192.168.30.0 24 192.168.12.1
25. ip route-static 192.168.60.0 24 192.168.23.3
26. ip route-static 192.168.70.0 24 192.168.23.3
27. 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.2
2. ip route-static 192.168.20.0 24 192.168.23.2
3. ip route-static 192.168.30.0 24 192.168.23.2
4. ip route-static 192.168.40.0 24 192.168.23.2
5. ip route-static 192.168.50.0 24 192.168.23.2
6. 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