当前位置:   article > 正文

ENSP华为路由器出口NAT实验_ensp实操题 ar1220配置nat

ensp实操题 ar1220配置nat

1:实验需求

公司拥有多个部门且位于不同网段,各部门均有访问Internet的需求。现要求用户通过二层交换机和路由器访问外部网络,且要求路由器作为用户的网关。

我们按照图示的IP地址进行配置,最终的结果是PC1和PC2可以ping通公网地址192.169.1.2.

2:网络拓补图

这里多说一句哈,华为的ENSP模拟器有的路由器NAT配置了不生效,我在这里使用的是AR1220系列。

3:实验过程

CORE

  1. <Huawei>sy
  2. Enter system view, return user view with Ctrl+Z.
  3. [Huawei]undo info-center enable
  4. Info: Information center is disabled.
  5. [Huawei]sysname CORE
  6. [CORE]vlan batch 2 3 100 //创建vlan 2 3 100备用
  7. Info: This operation may take a few seconds. Please wait for a moment...done.
  8. [CORE]dhcp enable //全局使能DHCP
  9. Info: The operation may take a few seconds. Please wait for a moment.done.
  10. [CORE]interface Vlanif 2 //进入vlanif接口配置IP,DHCP的方式是基于接口
  11. [CORE-Vlanif2]ip address 192.168.2.254 24
  12. [CORE-Vlanif2]dhcp select interface
  13. [CORE-Vlanif2]quit
  14. [CORE]interface Vlanif 3
  15. [CORE-Vlanif3]ip add 192.168.3.254 24
  16. [CORE-Vlanif3]dhcp select interface
  17. [CORE-Vlanif3]quit
  18. [CORE]interface Vlanif 100
  19. [CORE-Vlanif100]ip add 192.168.100.2 24
  20. [CORE-Vlanif100]quit
  21. [CORE]interface GigabitEthernet 0/0/1 //设置终端链路类型access
  22. [CORE-GigabitEthernet0/0/1]port link-type access
  23. [CORE-GigabitEthernet0/0/1]port default vlan 2
  24. [CORE-GigabitEthernet0/0/1]quit
  25. [CORE]interface GigabitEthernet 0/0/2
  26. [CORE-GigabitEthernet0/0/2]port link-type access
  27. [CORE-GigabitEthernet0/0/2]port default vlan 3
  28. [CORE-GigabitEthernet0/0/2]quit
  29. [CORE]interface GigabitEthernet 0/0/3 //设置链路终端类型,设置为access,路由器才能识别,或者trunk端口设置PVID。
  30. [CORE-GigabitEthernet0/0/3]port link-type access
  31. [CORE-GigabitEthernet0/0/3]port default vlan 100
  32. [CORE-GigabitEthernet0/0/3]quit
  33. [CORE]ip route-static 0.0.0.0 0.0.0.0 192.168.100.1 //写一条默认路由,下一跳地址是对端的路由器

ROUTER

  1. <Huawei>sy
  2. <Huawei>system-view
  3. Enter system view, return user view with Ctrl+Z.
  4. [Huawei]undo info-center enable
  5. Info: Information center is disabled.
  6. [Huawei]sysname ROUter
  7. [ROUter]interface GigabitEthernet 0/0/1 //我们配置内网的IP接口
  8. [ROUter-GigabitEthernet0/0/1]ip add 192.168.100.1 24
  9. [ROUter-GigabitEthernet0/0/1]quit
  10. [ROUter]ip route-static 192.168.0.0 16 192.168.100.2 //我们配置到内网的回程路由,即192.168.X.X均可以匹配
  11. [ROUter]ip route-static 0.0.0.0 0.0.0.0 192.169.1.2 //设置一条默认路由去公网
  12. [ROUter]interface GigabitEthernet 0/0/0 //配置公网的IP地址
  13. [ROUter-GigabitEthernet0/0/0]ip address 192.169.1.1 24
  14. [ROUter-GigabitEthernet0/0/0]quit
  15. [ROUter]acl 2000 //建基本ACL2000
  16. [ROUter-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255 //允许192.168.X.X的网段
  17. [ROUter-acl-basic-2000]quit
  18. [ROUter]interface GigabitEthernet 0/0/0 //进入外网接口,调用acl2000
  19. [ROUter-GigabitEthernet0/0/0]nat outbound 2000 //nat引用
  20. [ROUter-GigabitEthernet0/0/0]quit
  21. [ROUter]display nat session all //这里我们可以看到NAT会话
  22. NAT Session Table Information:
  23. Protocol : ICMP(1)
  24. SrcAddr Vpn : 192.168.2.253
  25. DestAddr Vpn : 192.169.1.2
  26. Type Code IcmpId : 0 8 890
  27. NAT-Info
  28. New SrcAddr : 192.169.1.1
  29. New DestAddr : ----
  30. New IcmpId : 10259
  31. Protocol : ICMP(1)
  32. SrcAddr Vpn : 192.168.2.253
  33. DestAddr Vpn : 192.169.1.2
  34. Type Code IcmpId : 0 8 888
  35. NAT-Info
  36. New SrcAddr : 192.169.1.1
  37. New DestAddr : ----
  38. New IcmpId : 10257
  39. Protocol : ICMP(1)
  40. SrcAddr Vpn : 192.168.2.253
  41. DestAddr Vpn : 192.169.1.2
  42. Type Code IcmpId : 0 8 889
  43. NAT-Info
  44. New SrcAddr : 192.169.1.1
  45. New DestAddr : ----
  46. New IcmpId : 10258
  47. Protocol : ICMP(1)
  48. SrcAddr Vpn : 192.168.2.253
  49. DestAddr Vpn : 192.169.1.2
  50. Type Code IcmpId : 0 8 887
  51. NAT-Info
  52. New SrcAddr : 192.169.1.1
  53. New DestAddr : ----
  54. New IcmpId : 10256
  55. Protocol : ICMP(1)
  56. SrcAddr Vpn : 192.168.2.253
  57. DestAddr Vpn : 192.169.1.2
  58. Type Code IcmpId : 0 8 886
  59. NAT-Info
  60. New SrcAddr : 192.169.1.1
  61. New DestAddr : ----
  62. New IcmpId : 10255

公网路由器

  1. <Huawei>sy
  2. <Huawei>system-view //我们给它设置一个测试用的IP地址
  3. [Huawei]interface GigabitEthernet 0/0/0
  4. [Huawei-GigabitEthernet0/0/0]ip add 192.169.1.2 24
  5. [Huawei-GigabitEthernet0/0/0]quit
  6. [Huawei]ping 192.169.1.1 //测试和公司公网IP的连通性
  7. PING 192.169.1.1: 56 data bytes, press CTRL_C to break
  8. Reply from 192.169.1.1: bytes=56 Sequence=1 ttl=255 time=90 ms
  9. Reply from 192.169.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
  10. Reply from 192.169.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
  11. Reply from 192.169.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
  12. Reply from 192.169.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
  13. --- 192.169.1.1 ping statistics ---
  14. 5 packet(s) transmitted
  15. 5 packet(s) received
  16. 0.00% packet loss
  17. round-trip min/avg/max = 20/38/90 ms
  18. [Huawei]

测试

我们使用PC1和PC2分别ping公网地址,如下图所示

会话信息

超简单啊,有木有~

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/774844
推荐阅读
相关标签
  

闽ICP备14008679号