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地址池