1 基础交换网络设计
1.1 需求
1)公司有三个部门,为确保通信安全,每个部门都处于独立的广播域
2)每个 部门的 IP 地址规划为: 192.168.xx.0/24
3)每个 部门的主机均通过为 DHCP 服务器获取 IP 地址,并且每个部门的网关 IP 地址为 192.168.xx.254
1.2 方案
使用 eNSP 搭建实验环境,如图 - 1 所示。

图 - 1
1.3 步骤
实现此案例需要按照如下步骤进行。
步骤一:配置二层交换机
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname sw15. \[sw1\]vlan batch 10 20 30 507. \[sw1\]interface e0/0/18. \[sw1-Ethernet0/0/1\]port link-type access9. \[sw1-Ethernet0/0/1\]port default vlan 1011. \[sw1\]interface e0/0/212. \[sw1-Ethernet0/0/2\]port link-type trunk13. \[sw1-Ethernet0/0/2\]port trunk allow-pass vlan all14. <Huawei>undo terminal monitor15. <Huawei>system-view16. \[Huawei\]sysname sw218. \[sw2\]vlan batch 10 20 30 5020. \[sw2\]interface e0/0/121. \[sw2-Ethernet0/0/1\]port link-type access22. \[sw2-Ethernet0/0/1\]port default vlan 2024. \[sw2\]interface e0/0/225. \[sw2-Ethernet0/0/2\]port link-type trunk26. \[sw2-Ethernet0/0/2\]port trunk allow-pass vlan all27. <Huawei>undo terminal monitor28. <Huawei>system-view29. \[Huawei\]sysname sw331. \[sw3\]vlan batch 10 20 30 5033. \[sw3\]interface e0/0/134. \[sw3-Ethernet0/0/1\]port link-type access35. \[sw3-Ethernet0/0/1\]port default vlan 3037. \[sw3\]interface e0/0/238. \[sw3-Ethernet0/0/2\]port link-type trunk39. \[sw3-Ethernet0/0/2\]port trunk allow-pass vlan all
步骤二:配置三层交换机
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname sw55. \[sw5\]vlan batch 10 20 30 507. \[sw5\]port-group group-member g0/0/1 to g0/0/38. \[sw5-port-group\]port link-type trunk9. \[sw5-port-group\]port trunk allow-pass vlan all11. \[sw5\]interface g0/0/512. \[sw5-GigabitEthernet0/0/5\]port link-type access13. \[sw5-GigabitEthernet0/0/5\]port default vlan 5015. \[sw5\]int Vlanif 1016. \[sw5-Vlanif10\]ip address 192.168.10.251 2417. \[sw5\]int Vlanif 2018. \[sw5-Vlanif20\]ip address 192.168.20.251 2419. \[sw5\]int Vlanif 3020. \[sw5-Vlanif30\]ip address 192.168.30.251 2421. \[sw5\]int Vlanif 5022. \[sw5-Vlanif50\]ip address 192.168.50.251 24
步骤三:配置 DHCP 服务器
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname dhcp5. \[dhcp\]dhcp enable7. \[dhcp\]ip pool vlan108. \[dhcp-ip-pool-vlan10\]network 192.168.10.0 mask 249. \[dhcp-ip-pool-vlan10\]gateway-list 192.168.10.25410. \[dhcp\]ip pool vlan2011. \[dhcp-ip-pool-vlan20\]network 192.168.20.0 mask 2412. \[dhcp-ip-pool-vlan20\]gateway-list 192.168.20.25413. \[dhcp\]ip pool vlan3014. \[dhcp-ip-pool-vlan30\]network 192.168.30.0 mask 2415. \[dhcp-ip-pool-vlan30\]gateway-list 192.168.30.25417. \[dhcp\]int g0/0/018. \[dhcp-GigabitEthernet0/0/0\]ip address 192.168.50.1 2419. \[dhcp-GigabitEthernet0/0/0\]dhcp select global21. \[dhcp\]ip route-static 0.0.0.0 0 192.168.50.251
步骤四:配置 DHCP 中继代理
1. \[sw5\]dhcp enable3. \[sw5\]int Vlanif 104. \[sw5-Vlanif10\]dhcp select relay5. \[sw5-Vlanif10\]dhcp relay server-ip 192.168.50.17. \[sw5\]int Vlanif 208. \[sw5-Vlanif20\]dhcp select relay9. \[sw5-Vlanif20\]dhcp relay server-ip 192.168.50.111. \[sw5\]int Vlanif 3012. \[sw5-Vlanif30\]dhcp select relay13. \[sw5-Vlanif30\]dhcp relay server-ip 192.168.50.1
步骤四:测试客户机
使用 ipconfig 命令测试
2 内网优化
2.1 问题
1)所有部门中都使用了网关冗余技术,为了增强网关稳定性和冗余性
2)交换机之间存在很多冗余链路,必须防止环路的发生,并且能够提高链路的利用率
3)要求每个部门的主机访问其他主机时,使用的都是最优的转发路径
2.2 方案
使用 eNSP 搭建实验环境,如图 - 2 所示。

图 - 2
2.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 sw6
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname sw65. \[sw6\]vlan batch 10 20 30 507. \[sw6\]port-group group-member gi0/0/1 to gi0/0/3 gi0/0/68. \[sw6-port-group\]port link-type trunk9. \[sw6-port-group\]port trunk allow-pass vlan all11. \[sw6\]int Vlanif 1012. \[sw6-Vlanif10\]ip address 192.168.10.252 2413. \[sw6\]int Vlanif 2014. \[sw6-Vlanif20\]ip address 192.168.20.252 2415. \[sw6\]int Vlanif 3016. \[sw6-Vlanif30\]ip address 192.168.30.252 24
2)配置 sw5
1. \[sw5\]int g0/0/62. \[sw5-GigabitEthernet0/0/6\]port link-type trunk3. \[sw5-GigabitEthernet0/0/6\]port trunk allow-pass vlan all
3)配置 sw1/sw2/sw3 与 sw6 相连的端口为 trunk 模式
1. \[sw1\]int e0/0/32. \[sw1-Ethernet0/0/3\]port link-type trunk3. \[sw1-Ethernet0/0/3\]port trunk allow-pass vlan all5. \[sw2\]int e0/0/36. \[sw2-Ethernet0/0/3\]port link-type trunk7. \[sw2-Ethernet0/0/3\]port trunk allow-pass vlan all9. \[sw3\]int e0/0/310. \[sw3-Ethernet0/0/3\]port link-type trunk11. \[sw3-Ethernet0/0/3\]port trunk allow-pass vlan all
4)配置 VRRP 协议
1. \[sw5\]int Vlanif 102. \[sw5-Vlanif10\]vrrp vrid 10 virtual-ip 192.168.10.2543. \[sw5-Vlanif10\]vrrp vrid 10 priority 2005. \[sw5\]int Vlanif 206. \[sw5-Vlanif20\]vrrp vrid 20 virtual-ip 192.168.20.2547. \[sw5-Vlanif20\]vrrp vrid 20 priority 2009. \[sw5\]int Vlanif 3010. \[sw5-Vlanif30\]vrrp vrid 10 virtual-ip 192.168.30.25414. \[sw6\]int Vlanif 1015. \[sw6-Vlanif10\]vrrp vrid 10 virtual-ip 192.168.10.25417. \[sw6\]int Vlanif 2018. \[sw6-Vlanif20\]vrrp vrid 20 virtual-ip 192.168.20.25420. \[sw6\]int Vlanif 3021. \[sw6-Vlanif30\]vrrp vrid 30 virtual-ip 192.168.30.25422. \[sw6-Vlanif30\]vrrp vrid 30 priority 200
5)验证 VRRP 状态
1. \[sw5\]display vrrp brief //查看VRRP协议信息2. VRID State Interface Type Virtual IP3. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-4. 10 Master Vlanif10 Normal 192.168.10.2545. 20 Master Vlanif20 Normal 192.168.20.2546. 30 Backup Vlanif30 Normal 192.168.30.2549. \[sw6\]display vrrp brief10. VRID State Interface Type Virtual IP11. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-12. 10 Backup Vlanif10 Normal 192.168.10.25413. 20 Backup Vlanif20 Normal 192.168.20.25414. 30 Master Vlanif30 Normal 192.168.30.25415. \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
5)配置 SW6 为 vlan10/20/30 的 DHCP 中继
1. \[sw6\]dhcp enable3. \[sw6\]int Vlanif 104. \[sw6-Vlanif10\]dhcp select relay5. \[sw6-Vlanif10\]dhcp relay server-ip 192.168.50.17. \[sw6\]int Vlanif 208. \[sw6-Vlanif20\]dhcp select relay9. \[sw6-Vlanif20\]dhcp relay server-ip 192.168.50.111. \[sw6\]int Vlanif 3012. \[sw6-Vlanif30\]dhcp select relay13. \[sw6-Vlanif30\]dhcp relay server-ip 192.168.50.115. \[sw6\]int Vlanif 5016. \[sw6-Vlanif50\]ip address 192.168.50.252 24
6)sw1/sw2/sw3/sw5/sw6 MSTP 基本配置
1. stp region-configuration2. region-name ntd3. instance 10 vlan 104. instance 20 vlan 205. instance 30 vlan 306. active region-configuration
7)指定每个生成树实例的主根网桥和备份根网桥
1. \[sw5\]stp instance 10 priority 02. \[sw5\]stp instance 20 priority 03. \[sw5\]stp instance 30 priority 40965. \[sw6\]stp instance 10 priority 40966. \[sw6\]stp instance 20 priority 40967. \[sw6\]stp instance 30 priority 0
3 连接外网服务器
3.1 问题
1)公司有一个出口设备 R1,连接一台外网的 Web 服务器
2)内网大量主机都需要访问这台外网的 Web 服务器
3.2 方案
使用 eNSP 搭建实验环境,如图 - 3 所示。

图 - 3
3.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 sw5
1. \[sw5\]vlan 152. \[sw5\]int g0/0/73. \[sw5-GigabitEthernet0/0/7\]port link-type access4. \[sw5-GigabitEthernet0/0/7\]port default vlan 155. \[sw5\]int Vlanif 156. \[sw5-Vlanif15\]ip address 192.168.15.5 248. \[sw5\]ip route-static 0.0.0.0 0 192.168.15.1
2)配置 sw6
1. \[sw6\]vlan 162. \[sw6-vlan16\]q3. \[sw6\]int g0/0/74. \[sw6-GigabitEthernet0/0/7\]port link-type access5. \[sw6-GigabitEthernet0/0/7\]port default vlan 166. \[sw6-GigabitEthernet0/0/7\]quit7. \[sw6\]int vlanif 168. \[sw6-Vlanif16\]ip address 192.168.16.6 249. \[sw6-Vlanif16\]quit11. \[sw6\]ip route-static 0.0.0.0 0 192.168.16.1
3)配置 r1
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname r14. \[r1\]interface g0/0/05. \[r1-GigabitEthernet0/0/0\]ip address 192.168.15.1 247. \[r1-\]interface g0/0/18. \[r1-GigabitEthernet0/0/1\]ip address 192.168.16.1 2410. \[r1-\]interface g0/0/211. \[r1-GigabitEthernet0/0/2\]ip address 100.1.1.1 2413. \[r1\]ip route-static 192.168.10.0 24 192.168.15.514. \[r1\]ip route-static 192.168.10.0 24 192.168.16.6 preference 10015. \[r1\]ip route-static 192.168.20.0 24 192.168.15.516. \[r1\]ip route-static 192.168.20.0 24 192.168.16.6 preference 10018. \[r1\]ip route-static 192.168.30.0 24 192.168.16.619. \[r1\]ip route-static 192.168.30.0 24 192.168.15.5 preference 10021. \[r1\]ip route-static 200.1.1.0 24 100.1.1.2
4)配置 r2
1. <Huawei>undo terminal monitor2. <Huawei>system-view3. \[Huawei\]sysname r24. \[r2\]interface g0/0/25. \[r2-GigabitEthernet0/0/2\]ip address 100.1.1.2 247. \[r2-\]interface g0/0/18. \[r2-GigabitEthernet0/0/1\]ip address 200.1.1.254 2410. \[r2\]ip route-static 192.168.0.0 16 100.1.1.1
5)配置外网服务器,如图 - 4 所示。

图 - 4
https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNA/DAY07/CASE/01/index.html
