NAT 端口映射

1. 实验拓扑

       使用GNS3模拟器版本 0.8.5

思科 GNS3 配置 NAT 端口映射


2.实验需求

1实现R2路由器上的C2 能够通过NAT端口映射上公网

2实现R1路由器上的C1能够通过NAT端口映射上公网

 

3.实验配置

  IP规划

C1

思科 GNS3 配置 NAT 端口映射

C2

思科 GNS3 配置 NAT 端口映射

R1(config)#int f0/0

R1(config-if)#ip add 12.0.0.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int f

R1(config-if)#int f0/1

R1(config-if)#ip add 192.168.10.1 255.255.255.0

R1(config-if)#no sh


R2#conf t  

R2(config)#int f0/0

R2(config-if)#ip add 12.0.0.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#

R2(config)#int f0/1

R2(config-if)#ip add 192.168.20.1 255.255.255.0

R2(config-if)#no sh


 配置脚本

R1(config)#int f0/0

R1(config-if)#ip nat outside

R1(config-if)#int f0/1

R1(config-if)#ip nat inside 

R1(config-if)#exit

R1(config)#ip nat inside source static tcp 192.168.10.100 80 12.0.0.1 8080 extendable  80 端口映射到8080端口

R2(config)#int f0/0

R2(config-if)#ip nat outside           配置外网口 

R2(config-if)#int f0/1

R2(config-if)#ip nat inside             配置内网口

R2(config-if)#exit

R2(config)#ip nat inside source static tcp 192.168.20.100 80 12.0.0.2 80 extendable  80端口映射到80端口

R2(config)#ip nat inside source static tcp 192.168.20.100 25 12.0.0.2 25 extendable  25端口映射到25端口

 

 

R1(config)#router ospf 1                  做OSPF动态路由

R1(config-router)#network 12.0.0.0 0.0.0.255 area 0

R1(config-router)#network 192.168.10.0 0.0.0.255 area 0

R1(config-router)#end

R2(config)#router ospf 1

R2(config-router)#network 12.0.0.0 0.0.0.255 area 0

R2(config-router)#network 192.168.20.0 0.0.0.255 area 0

R2(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.1

4.结果验证:


思科 GNS3 配置 NAT 端口映射

思科 GNS3 配置 NAT 端口映射

映射成功 实验结束