导读 eNSP是图形化网络仿真平台,该平台通过对真实网络设备的仿真模拟。网络转换技术也叫做NAT技术,他的作用就是实现私网IP和公网IP 的转换来达到网络的互通


实验环境:

pc:172.16.1.1/24

R1:g0/0/0 172.16.1.254/24 g0/0/1 192.168.1.254/24

server:192.168.1.1/24

pc和server在不同的网段,现在通过配置静态NAT实现网络互通。

网络配置
pc端

R1端
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.1.254 24
[R1-GigabitEthernet0/0/0]
May 21 2020 14:46:37-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/1]
May 21 2020 14:46:47-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
server端

配置NAT

将192.168.1.20(公网)与172.16.1.1(私网)地址进行绑定

[R1-GigabitEthernet0/0/1]nat static global 192.168.1.20 inside 172.16.1.1
测试
PC>ping 192.168.1.1

Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=254 time=15 ms
From 192.168.1.1: bytes=32 seq=2 ttl=254 time=15 ms
From 192.168.1.1: bytes=32 seq=3 ttl=254 time<1 ms
From 192.168.1.1: bytes=32 seq=4 ttl=254 time<1 ms From 192.168.1.1: bytes=32 seq=5 ttl=254 time=16 ms --- 192.168.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 0/9/16 ms PC>

由此,NAT转换配置成功!

本文原创地址:https://www.linuxprobe.com/ensp-nat.html编辑:王华超,审核员:逄增宝