设为首页收藏本站language 语言切换
查看: 1770|回复: 11
收起左侧

[已解决] 请问NAT的一些问题

[复制链接]
发表于 2012-7-9 21:08:44 | 显示全部楼层 |阅读模式
本帖最后由 PrinteLife 于 2012-7-9 21:12 编辑

                                           拓扑图.jpg 拓扑图如图所示,这是学习NAT,在R5上对内网IP进行静态IP映射的时候遇到的问题,求助各位前辈。 我这里拿了R1做测试,以下是R1的sh run :
R1(config)#do sh run
Building configuration...

Current configuration : 561 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!         
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
!
end

以下是R5的sh run:
R5(config)#do sh run
Building configuration...

Current configuration : 1099 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!         
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.254 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
interface Serial1/0
ip address 201.10.10.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
no ip http server
no ip http secure-server
!
!
ip nat inside source static 192.168.1.1 201.10.10.3
ip nat inside source static 192.168.1.2 201.10.10.4
ip nat inside source static 192.168.1.3 201.10.10.5
ip nat inside source static 192.168.1.4 201.10.10.6
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
!
!

为什么R1ping 201.10.10.1不通。
然后我对R1做了以下测试:
R1(config)#do sh run
Building configuration...

Current configuration : 610 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
no ip domain lookup
!
!
!
!         
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
no ip http server
no ip http secure-server
ip route 201.10.10.0 255.255.255.0 192.168.1.254
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
!
end

然后ping201.10.10.1通了。这是不是说明静态IP地址映射不成功?那么问题出在哪儿?我是新人,求指教,谢谢了


 楼主| 发表于 2012-7-9 21:33:41 | 显示全部楼层
求达人啊 。。。
沙发 2012-7-9 21:33:41 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-9 21:54:51 | 显示全部楼层
interface Serial1/0
没写 ip nat outside  
还有 没有定义 转换公网地址池
板凳 2012-7-9 21:54:51 回复 收起回复
回复 支持 反对

使用道具 举报

 成长值: 63680
发表于 2012-7-9 23:55:40 | 显示全部楼层
inside   outside
公网地址池
地板 2012-7-9 23:55:40 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-10 07:55:30 | 显示全部楼层
还没学呢,呵呵~~~
5# 2012-7-10 07:55:30 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-10 08:13:36 | 显示全部楼层
6# 2012-7-10 08:13:36 回复 收起回复
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-7-10 09:26:38 | 显示全部楼层
红拂女 发表于 2012-7-9 21:54
interface Serial1/0
没写 ip nat outside  
还有 没有定义 转换公网地址池

你好,我重新加了ip nat outside 问题依旧。
7# 2012-7-10 09:26:38 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-10 09:37:37 | 显示全部楼层
本帖最后由 sancome 于 2012-7-10 09:38 编辑

R1,R2,R3,R4上本来就应该有默认路由,你没写而已
ip route 0.0.0.0 0.0.0.0 192.168.1.254

如果你想测试静态映射有没有成功,应该在R6上 ping 201.10.10.3
8# 2012-7-10 09:37:37 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-10 10:21:23 | 显示全部楼层
两个问题,
r5 上面 s口的ip nat outside 没写
r1 -r4 路由没写
9# 2012-7-10 10:21:23 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-7-10 11:29:42 | 显示全部楼层
PrinteLife 发表于 2012-7-10 09:26
你好,我重新加了ip nat outside 问题依旧。

你配地址池了没??  还有 按常理说 私网是不能在公网上路由的  在模拟的环境是可以的  但在真实的环境是不行的 也就是说你的那个静态路由在模拟的时候可以 在实际中就需要NAT 你定义的是静态转换 需要有足够的地址映射池    再试试!
10# 2012-7-10 11:29:42 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2012-11-18 22:43:10 | 显示全部楼层
1.定义关于内部全局地址的地址池,如:R5(config)#ip nat pool aaa 201.10.0.1 201.10.0.6  netmask 255.255.255.0
2.利用PAT技术,ip nat ins list 1 pool aaa pat
                         accecc  1 192.168.1.0 0.0.0.255
11# 2012-11-18 22:43:10 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2013-4-14 12:31:54 | 显示全部楼层
1,你在R1上不能这么做:ip route 201.10.10.0 255.255.255.0 192.168.1.254,你这样会将内网暴露在公网。NAT就相当于没做。
2,如果你把R1当作是PC的话,你必须no ip routing 然后 ip default-getway   192.168.1.254 指定网关
3,如果你R1是路由器,那么内网必须有路由协议或者静态默认路由,只能是默认路由 ip route 0.0.0.0 0.0.0.0 192.168.1.254; 如果是路由协议就必须在R5上下发默认路由

4,我想知道你R6上的有何配置(再者来说,如果转换的地址为R6-R5之间同网段的话,R6可以不用配置,)

5,R5必须ip route 0.0.0.0 0.0.0.0   210.10.10.2  
12# 2013-4-14 12:31:54 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-5-9 12:47 , Processed in 0.075902 second(s), 24 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表