A-A+

华为防火墙NAT配置访问外网

2015年12月25日 电脑网络 暂无评论 阅读 5 views 次

AR1模拟外网,配置一个IP,在配置一个LoopBack地址,AR1的配置如下:

  1. interface GigabitEthernet0/0/0  
  2.  ip address 100.100.100.1 255.255.255.0   
  3. #  
  4. interface LoopBack1  
  5.  ip address 200.200.200.1 255.255.255.0   

USG的配置如下:

  1. #配置内网接口,开启DHCP  
  2. interface GigabitEthernet0/0/0  
  3.  ip address 192.168.10.1 255.255.255.0  
  4.  dhcp select interface  
  5.  dhcp server gateway-list 192.168.10.1  
  6.  dhcp server dns-list 8.8.8.8  
  7. #将GigabitEthernet0/0/0加入到Trust区域  
  8. firewall zone trust  
  9.  add interface GigabitEthernet0/0/0  
  10. #配置外网接口  
  11. interface GigabitEthernet0/0/1  
  12.  ip address 100.100.100.2 255.255.255.0  
  13. #将GigabitEthernet0/0/1加入到Untrust区域  
  14. firewall zone untrust  
  15.  add interface GigabitEthernet0/0/1  
  16. #开启域间包过滤规则,  
  17. policy interzone trust untrust outbound  
  18.  policy 0  
  19.   action permit  
  20.   policy source 192.168.10.0 0.0.0.255  
  21.   
  22. #配置缺省路由,确保局域网用户访问Internet路由可达  
  23.  ip route-static 0.0.0.0 0.0.0.0 100.100.100.1  
  24. #配置NAT,实现局域网用户能够访问Internet  
  25. nat-policy interzone trust untrust outbound  
  26.  policy 1  http://www.luyouqiboke.com/  
  27.   action source-nat  
  28.   policy source 192.168.10.0 0.0.0.255  
  29.   easy-ip GigabitEthernet0/0/1  

验证结果:

  1. #PC1可以ping通100.100.100.1和200.200.200.1  
  2.   
  3. PC>ping 100.100.100.1  
  4. Ping 100.100.100.1: 32 data bytes, Press Ctrl_C to break  
  5. From 100.100.100.1: bytes=32 seq=1 ttl=254 time=47 ms  
  6. From 100.100.100.1: bytes=32 seq=2 ttl=254 time=31 ms  
  7. From 100.100.100.1: bytes=32 seq=3 ttl=254 time=47 ms  
  8. From 100.100.100.1: bytes=32 seq=4 ttl=254 time=31 ms  
  9. From 100.100.100.1: bytes=32 seq=5 ttl=254 time=31 ms  
  10.   
  11. --- 100.100.100.1 ping statistics ---  
  12.   5 packet(s) transmitted  
  13.   5 packet(s) received  
  14.   0.00% packet loss  
  15.   round-trip min/avg/max = 31/37/47 ms  
  16.   
  17. PC>ping 200.200.200.1  
  18. Ping 200.200.200.1: 32 data bytes, Press Ctrl_C to break  
  19. From 200.200.200.1: bytes=32 seq=1 ttl=254 time=62 ms  
  20. From 200.200.200.1: bytes=32 seq=2 ttl=254 time=46 ms  
  21. From 200.200.200.1: bytes=32 seq=3 ttl=254 time=47 ms  
  22. From 200.200.200.1: bytes=32 seq=4 ttl=254 time=47 ms  
  23. From 200.200.200.1: bytes=32 seq=5 ttl=254 time=63 ms  
  24.   
  25. --- 200.200.200.1 ping statistics ---  
  26.   5 packet(s) transmitted  
  27.   5 packet(s) received  
  28.   0.00% packet loss  
  29.   round-trip min/avg/max = 46/53/63 ms  
  30.   
  31. #防火墙上的会话  
  32. <SRG>display firewall session table  
  33. 13:15:06  2014/03/18  
  34.  Current Total Sessions : 3  
  35.   icmp  VPN:public --> public 192.168.10.2:29142[100.100.100.2:2065]-->200.200.200.1:2048  
  36.   icmp  VPN:public --> public 192.168.10.2:29398[100.100.100.2:2066]-->200.200.200.1:2048  
  37.   icmp  VPN:public --> public 192.168.10.2:29654[100.100.100.2:2067]-->200.200.200.1:2048  
标签:

给我留言