檢驗NAT的運行和基本的NAT故障排除_第1頁
檢驗NAT的運行和基本的NAT故障排除_第2頁
檢驗NAT的運行和基本的NAT故障排除_第3頁
檢驗NAT的運行和基本的NAT故障排除_第4頁
檢驗NAT的運行和基本的NAT故障排除_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、檢驗NAT的運行和基本的NAT故障排除目錄介紹 開始之前 規(guī)則 前提條件 使用的組件 如何排除NAT 問題實例:可以ping通一臺路由器卻不能ping通另一臺路由器 問題總結(jié) 問題實例:外部網(wǎng)絡(luò)設(shè)備不能與內(nèi)部路由器通信 問題摘要 故障排除檢驗表 未在轉(zhuǎn)換表中安裝轉(zhuǎn)換 未使用正確的轉(zhuǎn)換條目 NAT運行正常,但是仍有連接問題 結(jié)論 相關(guān)信息 介紹在NAT環(huán)境中出現(xiàn)IP連接問題時,通常很難確定問題的原因。事實上在存在潛在問題的時候,常常錯誤地

2、歸咎于NAT。本文說明如何使用Cisco 路由器上現(xiàn)有的工具來驗證NAT的運行。我們還將向您說明如何執(zhí)行基本的NAT故障排除以及如何避免NAT故障排除中的常見問題。開始之前規(guī)則關(guān)于規(guī)則資料的更多信息,請參閱 Cisco技術(shù)提示規(guī)則。前提條件本文沒有特殊的前提條件。使用的組件本文不限于任何特定版本的軟件和硬件。本文所包含的信息基于特定試驗室環(huán)境中的設(shè)備。本文使用的所有設(shè)備都采用原始(缺?。┡渲谩H绻谡谶\行的網(wǎng)絡(luò)中進行操作,請確保您在使用之前了解所有命令的潛在影響。如何排除NAT在試圖確定IP連接問題的原因時,排除NAT很有幫助。采取以下步驟以驗證NAT是否在正常運行:1. 根據(jù)配置,明確定

3、義NAT要完成的任務(wù)。這時您可以確定該配置是否有問題。為了幫助配置NAT,請參閱配置網(wǎng)絡(luò)地址轉(zhuǎn)換:入門指南。2. 檢驗轉(zhuǎn)換表中是否有正確轉(zhuǎn)換。3. 使用show 和debug命令來檢驗是否正在進行轉(zhuǎn)換。4. 詳細觀察包的處理過程,并檢驗路由器是否有傳輸包需要的正確路由信息。以下是一些問題實例,在這里,我們使用上述步驟來幫助確定問題的原因。問題實例:可以ping通一臺路由器卻不能ping通另一臺路由器在下面的網(wǎng)絡(luò)圖中,我們發(fā)現(xiàn)以下癥狀:Router 4可以ping通Router 5(172.16.6.5),但卻不能ping通Router 7(172.16.11.7)。所有路由器都沒有運

4、行路由協(xié)議,而且Router 4將Router 6當作自己的缺省網(wǎng)關(guān)。采用以下方式配置Router 6的NAT:Router 6interface Ethernet0 ip address 172.16.6.6 255.255.255.0 ip directed-broadcast ip nat outside media-type 10BaseT ! interface Ethernet1 ip address 10.10.10.6 255.255.255.0 ip nat inside media-type 10BaseT ! interface Serial2.7 point-to-po

5、int ip address 172.16.11.6 255.255.255.0 ip nat outside frame-relay interface-dlci 101 ! ip nat pool test 172.16.11.70 172.16.11.71 prefix-length 24 ip nat inside source list 7 pool test ip nat inside source static 10.10.10.4 172.16.6.14 ! access-list 7 permit 10.10.50.4 access-list 7 permit 10.10.6

6、0.4 access-list 7 permit 10.10.70.4 首先讓我們確定NAT是否正常運行。我們從配置中可以知道,Router 4的IP地址(10.10.10.4)被假定為靜態(tài)地轉(zhuǎn)換成172.16.6.14。通過在Router 6上使用show ip nat translation命令,我們可以檢驗轉(zhuǎn)換表中是否存在該轉(zhuǎn)換。router-6#show ip nat translation Pro Inside global Inside local Outside local Outside global - 172.16.6.14 10.10.10.4 - - 現(xiàn)在,我們可以確定

7、在Router 4發(fā)出IP業(yè)務(wù)時在進行轉(zhuǎn)換。我們可以在Router 6上采用兩種方式來確定這一點:運行NAT debug 命令或者利用show ip nat statistics命令來監(jiān)控NAT的統(tǒng)計信息。由于debug 命令總是用作最終手段,因此我們將以show命令開始。這里的目的是監(jiān)控計數(shù)器,以便查看它是否隨著我們從Router 4發(fā)送業(yè)務(wù)而逐漸增加。每一次轉(zhuǎn)換表中的轉(zhuǎn)換被用于轉(zhuǎn)換一個地址時,計數(shù)器就會增加。我們首先清除統(tǒng)計信息,然后顯示統(tǒng)計信息,試著從Router 4上ping通Router 7,然后再顯示統(tǒng)計信息。router-6#clear ip nat statistic

8、s router-6# router-6#show ip nat statistics Total active translations: 1 (1 static, 0 dynamic; 0 extended) Outside interfaces: Ethernet0, Serial2.7 Inside interfaces: Ethernet1 Hits: 0 Misses: 0 Expired translations: 0 Dynamic mappings: - Inside Source access-list 7 pool test refcount 0 pool test: n

9、etmask 255.255.255.0 start 172.16.11.70 end 172.16.11.71 type generic, total addresses 2, allocated 0 (0%), misses 0 router-6#在Router 4上發(fā)出命令之后,Router 6 上的NAT統(tǒng)計信息顯示如下:router-6#show ip nat statistics Total active translations: 1 (1 static, 0 dynamic; 0 extended) Outside interfaces: Ethernet0, Serial2.

10、7 Inside interfaces: Ethernet1 Hits: 5 Misses: 0 Expired translations: 0 Dynamic mappings: - Inside Source access-list 7 pool test refcount 0 pool test: netmask 255.255.255.0 start 172.16.11.70 end 172.16.11.71 type generic, total addresses 2, allocated 0 (0%), misses 0 我們可以從show 命令中發(fā)現(xiàn)命中數(shù)增加5。在每

11、次從Cisco路由器成功完成一次ping操作時,命中數(shù)應該增加10。源路由器(Router 4)發(fā)送的5個互聯(lián)網(wǎng)控制消息協(xié)議(ICMP)回波應該被轉(zhuǎn)換,而且來自目的地路由器(Router 7)的5個回送應答包也應該被轉(zhuǎn)換,總共有10個命中包。5個丟失的命中包很可能是由回送應答未被轉(zhuǎn)換或者Router 7未發(fā)送回送應答造成的。讓我們轉(zhuǎn)向Router 7,看看我們是否可以發(fā)現(xiàn)一些Router 7不向Router 4發(fā)送回送應答包的原因。讓我們首先觀察NAT如何對包進行處理。Router 4正在發(fā)送ICMP回波包,其源地址為10.10.10.4,目的地地址為172.16.11.7。完成NAT之后,R

12、outer 7接收到的包的源地址為172.16.6.14,目的地地址為172.16.11.7。Router 7需要對172.16.6.14作出應答,而由于172.16.6.14沒有直接連接到Router 7,因此,它需要網(wǎng)絡(luò)的一個路由以便作出響應。讓我們檢查Router 7的路由列表,以便檢驗是否存在該路由。router-7#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OS

13、PF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static

14、 route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 4 subnets C 172.16.12.0 is directly connected, Serial0.8 C 172.16.9.0 is directly connected, Serial0.5 C 172.16.11.0 is directly connected, Serial0.6 C 172.16.5.0 is directly connected, Ethernet0我們發(fā)現(xiàn)Router 7的路由表沒有172.16.6.14的路由。只要我

15、們添加該路由,ping操作就可以正常進行。問題摘要我們首先定義NAT要完成的任務(wù)。接下來,我們檢驗轉(zhuǎn)換表中有靜態(tài)NAT條目而且是正確的。我們通過監(jiān)控NAT的統(tǒng)計信息來檢驗是否真正在進行轉(zhuǎn)換。我們在那里發(fā)現(xiàn)一個問題,使得我們檢查Router 7上的路由信息。我們發(fā)現(xiàn)Router 7需要一個到Router 4的內(nèi)部全局地址的路由。請注意,在這種簡單的試驗環(huán)境中,用show ip nat statistics命令來監(jiān)控NAT的統(tǒng)計信息很有用。但是,在進行多個轉(zhuǎn)換的更復雜NAT環(huán)境中,該show命令不再有用。在這種情況下,可能需要在路由器上運行debugs 命令。下一種情況的問題說明了deb

16、ug 命令的使用。問題實例:外部網(wǎng)絡(luò)設(shè)備不能與內(nèi)部路由器通信I在這種情況下,Router 4既能ping通Router 5,也能ping通Router 7,但是10.10.50.0網(wǎng)絡(luò)上的設(shè)備卻不能與Router 5或Router 7通信(我們在測試實驗室中通過從IP地址10.10.50.4的環(huán)回接口發(fā)出ping信號來模擬這種情況)。讓我們查看其網(wǎng)絡(luò)圖:Router 6interface Ethernet0 ip address 172.16.6.6 255.255.255.0 ip directed-broadcast ip nat outside media-type 10Bas

17、eT ! interface Ethernet1 ip address 10.10.10.6 255.255.255.0 ip nat inside media-type 10BaseT ! interface Serial2.7 point-to-point ip address 172.16.11.6 255.255.255.0 ip nat outside frame-relay interface-dlci 101 ! ip nat pool test 172.16.11.70 172.16.11.71 prefix-length 24 ip nat inside source lis

18、t 7 pool test ip nat inside source static 10.10.10.4 172.16.6.14 ! access-list 7 permit 10.10.50.4 access-list 7 permit 10.10.60.4 access-list 7 permit 10.10.70.4 在這種情況下,Router 4既能ping通Router 5,也能ping通Router 7,但是10.10.50.0網(wǎng)絡(luò)上的設(shè)備卻不能與Router 5或Router 7通信(我們在測試實驗室中通過從IP地址10.10.50.4的環(huán)回接口發(fā)出ping信號來模擬這種情況)。

19、讓我們查看其網(wǎng)絡(luò)圖:使用show ip route命令,我們發(fā)現(xiàn)Router 5的路由表確實列有172.16.11.0:router-5#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external

20、 type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 4 subnets C 172.16.9.0 is

21、directly connected, Serial1 C 172.16.6.0 is directly connected, Ethernet0 C 172.16.2.0 is directly connected, Serial0使用相同的命令,我們發(fā)現(xiàn)Router 7路由表將172.16.11.0列為直接連接的子網(wǎng):router-7#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF,

22、IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded

23、 static route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 5 subnets C 172.16.12.0 is directly connected, Serial0.8 C 172.16.9.0 is directly connected, Serial0.5 C 172.16.11.0 is directly connected, Serial0.6 C 172.16.5.0 is directly connected, Ethernet0 S 172.16.6.0 1/0 via 172.16.

24、11.6 我們現(xiàn)在已經(jīng)清楚地說明了NAT要做的內(nèi)容,我們需要檢驗它是否正常運行。我們以檢查NAT轉(zhuǎn)換表并檢驗預期的轉(zhuǎn)換是否在正在開始。因為我們所關(guān)心的轉(zhuǎn)換將被動態(tài)創(chuàng)建,因此,我們首先必須從相應地址發(fā)送IP業(yè)務(wù)。在發(fā)送一個從10.10.50.4到172.16.11.7的ping信號之后,Router 6的轉(zhuǎn)換表顯示如下:router-6#show ip nat translation Pro Inside global Inside local Outside local Outside global - 172.16.6.14 10.10.10.4 - - - 172.16.11.70 10.

25、10.50.4 - -由于轉(zhuǎn)換表中存在預期的轉(zhuǎn)換,因此,我們知道ICMP 回送包正在得到適當轉(zhuǎn)換,但是回送應答包又如何呢?如上所述,我們可以監(jiān)控NAT的統(tǒng)計信息,但是這在復雜的環(huán)境中卻不是很有用。另一種方法是在NAT路由器(Router 6)上進行NAT調(diào)試。本例中,我們將在Router 6上使用debug ip nat命令,同時發(fā)送一個從10.10.50.4到172.16.11.7的ping信號。debug結(jié)果如下:注:?/B>在路由器上運行任何debug命令時,都有可能使路由器過載并導致該路由器不能運行。請一定非常謹慎地使用,如果可能的話,沒有Cisco技術(shù)支援中心(TAC)工程師的

26、指導,不要在關(guān)鍵的生產(chǎn)路由器上運行debug命令。router-6#show log Syslog logging: enabled (0 messages dropped, 0 flushes, 0 overruns) Console logging: level debugging, 39 messages logged Monitor logging: level debugging, 0 messages logged Buffer logging: level debugging, 39 messages logged Trap logging: level informationa

27、l, 33 message lines logged Log Buffer (4096 bytes): 05:32:23: NAT: s=10.10.50.4->172.16.11.70, d=172.16.11.7 70 05:32:23: NAT*: s=172.16.11.7, d=172.16.11.70->10.10.50.4 70 05:32:25: NAT*: s=10.10.50.4->172.16.11.70, d=172.16.11.7 71 05:32:25: NAT*: s=172.16.11.7, d=172.16.11.70->10.10.5

28、0.4 71 05:32:27: NAT*: s=10.10.50.4->172.16.11.70, d=172.16.11.7 72 05:32:27: NAT*: s=172.16.11.7, d=172.16.11.70->10.10.50.4 72 05:32:29: NAT*: s=10.10.50.4->172.16.11.70, d=172.16.11.7 73 05:32:29: NAT*: s=172.16.11.7, d=172.16.11.70->10.10.50.4 73 05:32:31: NAT*: s=10.10.50.4->172.

29、16.11.70, d=172.16.11.7 74 05:32:31: NAT*: s=172.16.11.7, d=172.16.11.70->10.10.50.4 74正如我們從以上debug 命令輸出所見,第一行顯示源地址10.10.50.4正在被轉(zhuǎn)換成172.16.11.70。第二行顯示目的地地址172.16.11.70正在被轉(zhuǎn)換成10.10.50.4。整個debug命令執(zhí)行過程的其余部分會重復這一情況。這告訴我們Router 6正在兩個方向上轉(zhuǎn)換包。我們現(xiàn)在更加詳細準確地觀察正在發(fā)生的情況。Router 4發(fā)送一個從10.10.50.4到172.16.11.7的包。

30、Router 6對該包進行NAT并轉(zhuǎn)發(fā)一個源地址為172.16.11.70、目的地地址為172.16.11.7的包。Router 7發(fā)送一個源為172.16.11.7、目的地為172.16.11.70的應答。Router 6對該包進行NAT,產(chǎn)生一個源地址為172.16.11.7、目的地地址為10.10.50.4.的包。在這時,Router 6應該根據(jù)其路由表中的信息將此包路由到10.10.50.4。我們需要使用 show ip route命令來確認Router 6在路由表中有必需的路由。router-6#show ip route Codes: C - connected, S -

31、 static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS in

32、ter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 5 subnets C 172.16.8.0 is directly connected, Serial1 C 172.16.10.0 is directly connected, Serial2.8 C 172.16.11.0 is directly connected, Serial2.7 C 172.16.6.0 is directly connected, Ethernet0 C 172.16.7.0 is directly connected, Se

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論