2024年6月13日发(作者:)

图1 配置NAT使内网和外网用户通过外网IP访问内网服务器示例组网图

操作步骤

1. Router的配置

2. #

3. acl number 3000 //用于内部主机直接使用11.11.11.6访问服务器,只有内网

发起的服务才会在GE1/0/0上进行NAT

4. rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 11.11.11.6 0

5. #

6. interface GigabitEthernet1/0/0

7. ip address 192.168.1.1 255.255.255.0

8. nat static global 11.11.11.6 inside 192.168.1.2 netmask 255.255.255.255

//配置内网服务器地址的一对一NAT

9. nat outbound 3000 //内网用户直接访问11.11.11.6时做Easy IP,将源地址

改为GE1/0/0的地址,保证内网服务器和主机间的交互都经过Router转发

10. #

11. interface GigabitEthernet2/0/0

12. ip address 11.11.11.1 255.0.0.0

13. nat static global 11.11.11.6 inside 192.168.1.2 netmask

255.255.255.255 //保证外网用户使用11.11.11.6可以访问内网服务器

14. #

15. ip route-static 0.0.0.0 0.0.0.0 11.11.11.2 //配置缺省路由,保证内网

用户与外网互通

16. #

return

17. 检查配置结果