本次實(shí)驗(yàn)是任務(wù)2基礎(chǔ)上進(jìn)行的,主要目的是為了說(shuō)明普通的ACL不帶OVERLOAD的NAT是有缺陷的,由于這種情況下的NAT條目里只有 內(nèi)部本地和內(nèi)部全局映射關(guān)系,路由器一旦之前已經(jīng)存在某條映射,那么下次即使是目的地不同,路由器也還會(huì)使用上一次的映射條目,這將導(dǎo)致嚴(yán)重的問(wèn)題.
本次實(shí)驗(yàn)只是在路由器P1R1上新增了一個(gè)NAT轉(zhuǎn)換條件,其他配置不變.
關(guān)于實(shí)驗(yàn)路由器命名以及與書(shū)上ip地址不同的變動(dòng)請(qǐng)參看任務(wù)2的說(shuō)明
P1R1的配置(紅色部分為新增配置):
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service passWord-encryption
!
hostname r1-2514
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.0.0.0
!
interface Ethernet0
ip address 10.1.1.1 255.255.255.0
ip nat inside
!
interface Ethernet1
no ip address
shutdown
!
interface Serial0
ip address 172.31.1.1 255.255.255.0
ip nat outside
encapsulation frame-relay
no arp frame-relay
frame-relay map ip 172.31.1.2 102 broadcast
frame-relay map ip 172.31.1.5 105 broadcast
no frame-relay inverse-arp
!
interface Serial1
ip address 10.1.0.1 255.255.255.0
ip nat outside
clock rate 125000
!
ip nat pool bbr 192.168.1.1 192.168.1.254 PRefix-length 24
ip nat pool pod 10.1.0.64 10.1.0.95 netmask 255.255.255.0
ip nat inside source list 100 pool bbr
ip nat inside source list 101 pool pod
ip http server
ip classless
ip route 10.0.0.0 255.0.0.0 172.31.1.5
!
!
access-list 100 permit ip 10.1.1.0 0.0.0.255 10.254.0.0 0.0.0.255
access-list 101 permit ip 10.1.1.0 0.0.0.255 any
!
!
line con 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
P1R2的配置:
===================
分析:首先根據(jù)任務(wù)2我們知道,ping 10.254.0.254之后,P1R1路由器將產(chǎn)生一條NAT條目:
r1-2514#show ip nat trans
Pro Inside global Inside local Outside local Outside global
--- 192.168.1.1 10.1.1.3 --- ---
接著我們?cè)赑1R3路由器上ping P1R2的ip
r3-2514#ping 10.1.0.2
我們發(fā)現(xiàn)是不通的,為什么呢?根據(jù)上面我們知道NAT表里已經(jīng)存在了內(nèi)部本地為10.1.1.3這個(gè)條目,所以路由器將繼續(xù)認(rèn)為這個(gè)條目也適用于ping 10.1.0.2的,來(lái)看路由器調(diào)試的結(jié)果:
r1-2514#
*Mar 1 00:26:09.215: NAT*: s=10.1.1.3->192.168.1.1, d=10.1.0.2 [11]
r1-2514#
*Mar 1 00:26:11.215: NAT*: s=10.1.1.3->192.168.1.1, d=10.1.0.2 [12]
r1-2514#
*Mar 1 00:26:13.299: NAT*: s=10.1.1.3->192.168.1.1, d=10.1.0.2 [13]
r1-2514#
*Mar 1 00:26:15.299: NAT*: s=10.1.1.3->192.168.1.1, d=10.1.0.2 [14]
從上面我看到到目標(biāo)10.1.0.2這個(gè)過(guò)程 源IP 10.1.1.3繼續(xù)被轉(zhuǎn)為192.168.1.1了,而我們知道P1R2上是沒(méi)有到192.168.1.0/24這個(gè)網(wǎng)絡(luò)的路由的,所以不可能PING通.看P1R2上調(diào)試結(jié)果:
*Mar 1 00:27:20.127: ICMP: echo reply sent, src 10.1.0.2, dst 192.168.1.1
r2-2514(config)#
*Mar 1 00:27:22.059: ICMP: echo reply sent, src 10.1.0.2, dst 192.168.1.1
回顯消息從10.1.0.2發(fā)向了192.168.1.1,而R2這個(gè)路由器又沒(méi)有到這個(gè)網(wǎng)絡(luò)的路由條目,數(shù)據(jù)包必然被丟棄.
此時(shí),假如我們之前清除掉已經(jīng)存在的這個(gè)NAT條目,讓NAT表是空的,這個(gè)時(shí)候我們直接來(lái)PING 10.1.0.2來(lái)看看是否通:
r1-2514#clear ip nat trans *
r1-2514#show ip nat trans
r1-2514#
r3-2514#ping 10.1.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.2, timeout is 2 seconds:
!!!!!
SUCcess rate is 100 percent (5/5), round-trip min/avg/max = 32/32/36 ms
r3-2514#
我們看到.這個(gè)時(shí)候ping通了,為什么?因?yàn)槁酚善鬟@次正確的將10.1.1.3轉(zhuǎn)換成了10.1.0.64.看調(diào)試結(jié)果:
*Mar 1 00:28:57.727: NAT: s=10.1.1.3->10.1.0.64, d=10.1.0.2 [20]
*Mar 1 00:28:57.751: NAT*: s=10.1.0.2, d=10.1.0.64->10.1.1.3 [20]
*Mar 1 00:28:57.763: NAT*: s=10.1.1.3->10.1.0.64, d=10.1.0.2 [21]
*Mar 1 00:28:57.787: NAT*: s=10.1.0.2, d=10.1.0.64->10.1.1.3 [21]
*Mar 1 00:28:57.795: NAT*: s=10.1.1.3->10.1.0.64, d=10.1.0.2 [22]
*Mar 1 00:28:57.819: NAT*: s=10.1.0.2, d=10.1.0.64->10.1.1.3 [22]
*Mar 1 00:28:57.827: NAT*: s=10.1.1.3->10.1.0.64, d=10.1.0.2 [23]
*Mar 1 00:28:57.851: NAT*: s=10.1.0.2, d=10.1.0.64->10.1.1.3 [23]
*Mar 1 00:28:57.859: NAT*: s=10.1.1.3->10.1.0.64, d=10.1.0.2 [24]
*Mar 1 00:28:57.883: NAT*: s=10.1.0.2, d=10.1.0.64->10.1.1.3 [24]
r1-2514#show ip nat trans
Pro Inside global Inside local Outside local Outside global
--- 10.1.0.64 10.1.1.3 --- ---
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注