Cisco 靜態nat配置

實驗拓撲

在這裏插入圖片描述

實驗需求

  1. pc8 ping pc9映射的公網地址192.168.1.9 而nat內部地址無法ping通
  2. pc9 ping pc8映射的公網地址192.168.1.8 而nat內部地址無法ping通

實驗思路

  1. 分別在路由器進行地址映射
  2. 對端口進行配置IP

實驗步驟

R6

Router(config)#int e0/0
Router (config-if)#ip add 192.168.2.1 255.255.255.0
Router (config-if)#no shut
Router (config-if)#
*Aug 18 08:29:47. 914: %LINK-3- UPDOWN: Interface Ethernet0/O, changed state to up
*Aug 18 08:29:48.915: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed S
Router(config-if)#ip nat ou
Router ( config-if)#ip nat outside
*Aug 18 08:30: 11.609: %LINEPROTO-5-UPDOWN L ine protocol on Interface NVIO, changed state to
Router(config-if)#
Router(config-if)#int e0/1
Router (config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if )#no shut
Router(config-if)#
*Aug 18 08:31:12.241: %LINK-3- UPDOWN: Interface Ethernet0/1, changed state to up
*Aug 18 08:31:13.253: %LINEPROTO-5-UPDOWN L ine protocol on Interface Ethernet0/1, changed S
Router(config-if)#ip nat in
Router( config-if )#ip nat inside
Router (config)#ip nat source static 1
Router(config)#ip nat source static 192.168.2.2 192.168.1.9

R7

Router (config)#int e0/0
Router (config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if )#no shut
Router(config-if)#
*Aug 18 08:38:13.771: %LINK-3- UPDOWN: Interface Ethernet0/O, changed state to up
nged state to do
*Aug 18 08:38:14.779: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
Router(config-if )#ip nat
Router(config-if )#ip nat outside
*Aug 18 08:38:25.586: %LINEPROTO-5-UPDOWN L ine protocol on Interface NVIO, changed state to up
Router(config-if)#
Router(config-if)#
Router(config-if)#int e0/1
Router (config-if)#ip add 192.168.1.2 255.255.255.0
Router(config-if )#no shut
Router(config-if)#
*Aug 18 08:39:20.040: %LINK -3-UPDOWN: Interface Ethernet0/1, changed state to up
*Aug 18 08 :39:21.049: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up
Router(config-if)#ip nat in
Router(config-if)#ip nat inside
Router (config)#ip nat source static 192.168.3.2 192.168.1.8

PC8
VPCS> ip 192.168.2.2 255.255.255.0 192.168.2.1
Checking for duplicate address. .
PC1 :
192.168.2.2 255.255.255.0 gateway 192.168.2. 1

PC9
VPCS> ip 192.168.3.2 255.255.255.0 192.168.3.1
Checking for duplicate address…
PC1 : 192.168.3.2 255.255.255.0 gateway 192.168.3.1

實驗結果

PC9

在這裏插入圖片描述
PC8
在這裏插入圖片描述

實驗總結

對nat 出口轉換爲公網地址的映射爲公網IP地址池