NAT 端口映射
1. 實驗拓撲
使用GNS3模擬器版本 0.8.5
2.實驗需求
1實現R2路由器上的C2 能夠通過NAT端口映射上公網
2實現R1路由器上的C1能夠通過NAT端口映射上公網
3.實驗配置:
IP規劃
C1
C2
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.結果驗證:
映射成功 實驗結束