请问NAT的一些问题
本帖最后由 PrinteLife 于 2012-7-9 21:12 编辑拓扑图如图所示,这是学习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地址映射不成功?那么问题出在哪儿?我是新人,求指教,谢谢了
{:6_278:}求达人啊 。。。 interface Serial1/0
没写 ip nat outside
还有 没有定义 转换公网地址池
{:6_264:} {:6_276:}inside outside
公网地址池 还没学呢,呵呵~~~{:6_264:}{:6_264:}{:6_264:}{:6_264:}{:6_264:}{:6_264:} {:6_290:}{:6_290:} 红拂女 发表于 2012-7-9 21:54 static/image/common/back.gif
interface Serial1/0
没写 ip nat outside
还有 没有定义 转换公网地址池
你好,我重新加了ip nat outside 问题依旧。 本帖最后由 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
两个问题,
r5 上面 s口的ip nat outside 没写
r1 -r4 路由没写 PrinteLife 发表于 2012-7-10 09:26 static/image/common/back.gif
你好,我重新加了ip nat outside 问题依旧。
你配地址池了没??还有 按常理说 私网是不能在公网上路由的在模拟的环境是可以的但在真实的环境是不行的 也就是说你的那个静态路由在模拟的时候可以 在实际中就需要NAT 你定义的是静态转换 需要有足够的地址映射池 再试试! 1.定义关于内部全局地址的地址池,如:R5(config)#ip nat pool aaa 201.10.0.1 201.10.0.6netmask 255.255.255.0
2.利用PAT技术,ip nat ins list 1 pool aaa pat
accecc1 192.168.1.0 0.0.0.255
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
页:
[1]