思科 GNS3 配置 NAT 端口映射

              NAT 端口映射

1. 實驗拓撲

       使用GNS3模擬器版本 0.8.5

wKiom1RwK6OAAdiYAADu5ZUvlTs056.jpg


2.實驗需求

1實現R2路由器上的C2 能夠通過NAT端口映射上公網

2實現R1路由器上的C1能夠通過NAT端口映射上公網

 

3.實驗配置

  IP規劃

C1

wKioL1RwLH-RbU8kAACCsBwpUAQ234.jpg

C2

wKiom1RwLFfSAHpGAACTUxW6cPg619.jpg

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.結果驗證:


wKioL1RwLSuTUdutAABpyqXsNbw188.jpg

wKiom1RwLLDSZsTXAACPNldvu8E631.jpg

映射成功 實驗結束






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章