A-A+

H3C路由器NAT配置的组网需求/拓扑/软件的示例

2015年11月23日 站长资讯 暂无评论

【组网需求】
一个公司拥有202.38.1.1/24至202.38.1.3/24三个公网IP地址,内部网址为172.16.1.0/24。互联地址用的是192.168.1.0/30网段。通过配置NAT使得仅内部网络中1172.16.1.0/24网段的用户可以访问Internet。

【拓扑和软件】

本文实验采用的交换机是H3C模拟器,下载地址如下: http://forum.h3c.com/forum.php? mod=viewthread&tid=109740&highlight=H3C%E6%A8%A1%E6% 8B%9F%E5%99%A8 有兴趣的朋友可以在H3C官网论坛上去下载,里面有非常详细的使用说明以及自定义拓扑的方法。

【配置文本】

  1. R1:  
  2. acl number 2001  
  3.  rule 0 permit source 172.16.1.0 0.0.0.255  
  4.  rule 5 deny  
  5. #  
  6. interface Serial0/6/0  
  7.  link-protocol ppp  
  8.  nat outbound 2001 address-group 1  
  9.  ip address 202.38.1.1 255.255.255.0  
  10. #  
  11. interface Serial0/6/1  
  12.  link-protocol ppp  
  13.  ip address 192.168.1.1 255.255.255.252  
  14. #  
  15. interface Serial0/6/2  
  16.  link-protocol ppp  
  17. #  
  18. interface Serial0/6/3  
  19.  link-protocol ppp  
  20. #  
  21.    
  22. #                 
  23.  ip route-static 0.0.0.0 0.0.0.0 202.38.1.4  
  24.  ip route-static 172.16.1.0 255.255.255.0 192.168.1.2  
  25.    
  26. R2  
  27.    
  28. #  
  29. interface Serial0/6/0  
  30.  link-protocol ppp  
  31.  ip address 202.38.1.4 255.255.255.0  
  32. #  
  33. interface Serial0/6/1  
  34.  link-protocol ppp  
  35. #  
  36. interface Serial0/6/2  
  37.  link-protocol ppp  
  38. #  
  39. interface Serial0/6/3  
  40.  link-protocol ppp  
  41. #  
  42. interface NULL0  
  43. #  
  44. interface LoopBack0  
  45.  ip address 2.2.2.2 255.255.255.255  
  46.    
  47.    
  48. #  
  49.  ip route-static 0.0.0.0 0.0.0.0 202.38.1.1  
  50.    
  51.    
  52. R3:  
  53.    
  54.    
  55. interface Serial0/6/1  
  56.  link-protocol ppp  
  57.  ip address 192.168.1.2 255.255.255.252  
  58. #  
  59. interface Serial0/6/2  
  60.  link-protocol ppp  
  61. #  
  62. interface Serial0/6/3  
  63.  link-protocol ppp  
  64. #  
  65. interface NULL0  
  66. #  
  67. interface LoopBack0  
  68.  ip address 172.16.1.1 255.255.255.255  
  69.    
  70. #  
  71.  ip route-static 0.0.0.0 0.0.0.0 192.168.1.1  

【实验过程】

  1. <R3>ping -a  172.16.1.1  -c 1000 2.2.2.2  
  2.   PING 2.2.2.2: 56  data bytes, press CTRL_C to break  
  3.     Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=254 time=19 ms  
  4.     Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=254 time=30 ms  
  5.     Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=254 time=10 ms  
  6.     Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=254 time=10 ms  
  7.     Request time out  
  8.     Reply from 2.2.2.2: bytes=56 Sequence=6 ttl=254 time=15 ms  
  9.     Reply from 2.2.2.2: bytes=56 Sequence=7 ttl=254 time=15 ms  
  10.     Reply from 2.2.2.2: bytes=56 Sequence=8 ttl=254 time=5 ms  
  11.    
  12.    
  13. <R1>dis nat se  
  14. <R1>dis nat server  
  15. <R1>dis nat session  当前的NAT 会话  
  16.    
  17. There are currently 1 NAT session:  
  18.    
  19. Protocol      GlobalAddr  Port      InsideAddr  Port        DestAddr  Port  
  20.        1      202.38.1.3 12288      172.16.1.1  1280         2.2.2.2  1280  
  21.  VPN:  0,        status:    11,        TTL: 00:01:00,       Left: 00:00:59  

字段 描述

Protocol 协议类型

GlobalAddr Port 转换后的外部源地址和源端口

InsideAddr Port 转换前的内部源地址和源端口

DestAddr Port 目的地址和端口

VPN 转换表项所属MPLS VPN实例的名称

status 表项的状态特征

TTL 表项的生命周期,单位为小时:分钟:秒钟

Left 表项的剩余的存活时间,单位为小时:分钟:秒钟

  1. <R1>  
  2. <R1>t d  
  3. % Current terminal debugging is on  
  4.    
  5. <R1>t m  
  6. % Current terminal monitor is on  
  7.    
  8. <R1>deb  
  9. <R1>debugging nat pa  
  10. <R1>debugging nat packet   
  11.   NAT packet debugging is enabled  
  12. <R1>  
  13. *Mar  6 14:28:06:578 2013 R1 NAT/7/debug:  
  14. (Serial0/6/0-out :)Pro : ICMP   
  15. (     172.16.1.1: 1280 -         2.2.2.2: 1280) ------>  
  16. (     202.38.1.3:12288 -         2.2.2.2: 1280)  
  17. *Mar  6 14:28:06:578 2013 R1 NAT/7/debug:  
  18. (Serial0/6/0-in  :)Pro : ICMP   
  19. (        2.2.2.2: 1280 -      202.38.1.3:12288) ------>  
  20. (        2.2.2.2: 1280 -      172.16.1.1: 1280)  
  21. *Mar  6 14:28:06:781 2013 R1 NAT/7/debug:  
  22. (Serial0/6/0-out :)Pro : ICMP   
  23. (     172.16.1.1: 1280 -         2.2.2.2: 1280) ------>  
  24. (     202.38.1.3:12288 -         2.2.2.2: 1280)  
  25. *Mar  6 14:28:06:797 2013 R1 NAT/7/debug:  
  26. (Serial0/6/0-in  :)Pro : ICMP   
  27. (        2.2.2.2: 1280 -      202.38.1.3:12288) ------>  
  28. (        2.2.2.2: 1280 -      172.16.1.1: 1280)  
  29. *Mar  6 14:28:07:00 2013 R1 NAT/7/debug:  
标签:

给我留言