NAT之server nat

NAT之server nat

可以将某服务器的某端口映射出去(非常安全)

在这里插入图片描述

PC1(IP地址)
IP地址:192.168.31.1
子网掩码:255.255.255.0
网关:192.168.31.254
PC2(IP地址)
IP地址:192.168.31.2
子网掩码:255.255.255.0
网关:192.168.31.254
Server1(IP地址)
IP地址:192.168.31.3
子网掩码:255.255.255.0
网关:192.168.31.254

Client1(IP地址)

IP地址:9.9.9.9
子网掩码:255.255.255.0
网关:9.9.9.1
R1(设置IP地址)
<Huawei>system-view     //进入全局配置模式
[Huawei]undo info-center enable      //关闭信息告警提示
[Huawei]sysname R1     //改名
[R1]interface g0/0/0     //进入接口
[R1-GigabitEthernet0/0/0]ip address 192.168.31.254 24     //设置IP地址
[R1-GigabitEthernet0/0/0]quit     //退出
[R1]interface g0/0/1     //进入接口
[R1-GigabitEthernet0/0/1]ip address 12.1.1.1 29      //设置IP地址
[R1-GigabitEthernet0/0/1]quit     //退出
[R1]
R2(设置IP地址)
<Huawei>system-view     //进入全局配置模式
[Huawei]undo info-center enable     //关闭信息告警提示
[Huawei]sysname R2     //改名
[R2]interface g0/0/0     //进入接口
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 29     //设置IP地址
[R2-GigabitEthernet0/0/0]quit     //退出
[R2]interface g0/0/1     //进入接口
[R2-GigabitEthernet0/0/1]ip address 9.9.9.1 24     //设置IP地址
[R2-GigabitEthernet0/0/1]quit     //退出
[R2]
R1(默认路由)
[R1]ip route-static 0.0.0.0 0 12.1.1.2     //设置默认路由
[R1]
R1(将服务器的80端口映射出去)
[R1]interface g0/0/1     //进入接口
[R1-GigabitEthernet0/0/1]nat server protocol tcp global 12.1.1.4 www inside 192.168.31.3 www     //将服务器的80端口映射出去
[R1-GigabitEthernet0/0/1]quit     //退出
[R1]

在这里插入图片描述

发布了68 篇原创文章 · 获赞 23 · 访问量 7812

猜你喜欢

转载自blog.csdn.net/Yang__Qi/article/details/102805235
NAT