第1段:測(cè)試基本的連通性 Term_Server#1 [Resuming connection I to R1 ...] R1#ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! SUCcess rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms Ripping 172.16.1.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.3, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 4/4/4 ms R1# (鍵入ctrl+shift+6,x,切換回終端服務(wù)器) Term_Server#2 [Resuming connection 2 to R2 ... ]
R2#ping 172.16.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: ..... R2#sh ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 0 - 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 inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route
Gateway of last resort is not set 第2段:加入靜態(tài)路由并測(cè)試連通性 R2#conft Enter configuration commands, one per line. End with CNTL/Z, R2(config)#ip route 172.16.1.0 255.255.255.0 10.1.1.1 R2(config)#end R2#sh ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 0 - 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 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, 1 subnets S 172.16.1.0[1/0]via 10.1.0.1 10.0.0.0/24 is subnetted,1subnets C 10.1.1.0 is directly connected, EthernetO R2#ping 172.16.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: HW R2#ping 172.16.1.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos 10172.16.1.3, timeout is 2 seconds: ..... success rate is 0 percent(0/5) R2# (鍵入ctrl+shift+6,x,切換回終端服務(wù)器) Term_Server#3 [Resuming connection 3 to R3 ... ] R3#conft Enter configuration commands, one per line. End with CNTL/Z. R3(config)#ip route 10.1.1.0 255.255.255.0 172.16.1.1 R3(config)#^Z R3#ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms R3# R3#sh ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP externa1, 0 -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, LI - 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, 1 subnets C 172.16.1.0 is directly connected, EthernetO 10.0.0.0/24 is subnetted, 1 subnets S 10.1.1.0[1/0]via 172.16.1.1 . R3# Term_Server#1 [Resuming connection I to R1 ... ] R1#sh ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 0 - 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, LI - 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,1 subnets C 172.16.1.0 is directly connected Ethernet0 10.0.0.0/24 is subnetted,1 subnets C 10.1.1.0 is directly connected Ethernet0 R1# (鍵入ctrl+shift+6, x切換回終端服務(wù)器) Term_Server#2 [Resuming connection 2 to R2 ... ] R2#sh ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 0 - 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, LI - 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
S 172.16.0.0/24 is subnetted, 1 subnets 10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Ethernet0 R2# (鍵入ctrl+shift+6, x切換回終端服器) 第3段:使用trace命令 Term_Server#3 [Resuming connection 3 to R3 ... ] R3#trace 10.1.1.2 Type escape sequence to abort. Tracing the route to 10.1.1.2 1 172.16.1.14msec 4 msec 4 msec 2 10.1.1.24msec 4 msec* R3# (鍵入ctrl+shift+6, x切換回終端服務(wù)器) 第4段:禁用IP路由功能 Term_Server#1 [Resuming connection I to R1 ... ] R1#conft Enter configuration commands, one per line. End with CNTL/Z. R1(config)#no ip routing R1(config)# R1#sh ip route Default gateway is not set
Host Gateway Last Use Total Uses Interface ICMP R1# (鍵入ctrl+shift+6,x切回?fù)Q回終端服務(wù)器) Term_Server#3 [Resuming connection 3 to R3 ... ]
R3#ping 172.16.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: .!!!! Success rate. ia 80 percent (4/5), round-trip min/avg/max=4/5/8ms R3#ping 10.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!! Successrateis 100 percent(5/5>,round-trip min/avg/max=4/4/4ms R3#ping 10.1.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: Success rate is 0 percent(0/5) R3# (1)配置好各路由器的以太網(wǎng)接口地址后,在R1上用ping命令測(cè)試各網(wǎng)段內(nèi)部的連通性。結(jié)果表明,R1到R2、R1到R3在IP層是正常連通的。 (2)接下來(lái)轉(zhuǎn)到R2路由器上,在R2上ping172.16.1.1,即R1的E1接口地址,這是跨網(wǎng)段的ping,可以看到,沒(méi)有ping通。 (3)在R2上執(zhí)行show ip route命令查看其路由表,結(jié)果顯示只有直接相連的網(wǎng)段10.1.1.0/24在其路由表內(nèi),標(biāo)志為"C",即connected。 (4)在R2上加入1條靜態(tài)路由: ip route 172.16.1.0 255.255.255.0 10.1.1.1 這個(gè)語(yǔ)句的意思是:從本路由器出發(fā),發(fā)往172.16.1.0 0 255.255.255.0網(wǎng)段的數(shù)據(jù)包,其下一跳點(diǎn)(Next Hop)的地址是10.1.1.1(即R1的E0接口地址)。 (5)在R2上配置好靜態(tài)路由后,查看其路由表,結(jié)果顯示剛剛加入的靜態(tài)路由己經(jīng)生效了。該路由表項(xiàng)前的"S"表示是靜態(tài)(static)路由,中括號(hào)內(nèi)的"1/10"表示這條路由的治理距離是1,度量值是0。這兩個(gè)概念將在后續(xù)的實(shí)驗(yàn)中多次看到并加以說(shuō)明。 (6)在R2上再次Ping172.16.1.1,成功;但是Ping與172.16.1.1處于同一個(gè)網(wǎng)段的172.16.1.3 (R3)則不成功。 上述結(jié)果的解釋為: 在R2路由器上配置了到網(wǎng)段172.16.1.0/24的靜態(tài)路由后,從R2發(fā)出的ICMP Echo包可以到達(dá)R1和R3路由器。R1路由器路由表內(nèi)有到10.1.1.0/24網(wǎng)段的路由(直接相連),而R3、路由器則沒(méi)有相應(yīng)的路由表項(xiàng)。結(jié)果是R1可以發(fā)送ICMP Echo Reply包到10.1.1.2,而R3則不能發(fā)送ICMP Echo Reply包到1O.1.1.2,原因是沒(méi)有到10.1.1.0/24網(wǎng)段的路由。 可能有一些喜歡深究問(wèn)題的讀者會(huì)問(wèn):你憑什么作如此解釋,為什么不可以是從R1發(fā)出的ICMP包沒(méi)有到達(dá)R3造成的ping不通R3? 我們可以用路由器上的監(jiān)測(cè)結(jié)果來(lái)說(shuō)明這個(gè)問(wèn)題。 在R3上發(fā)出命令debug ip packet和debug ip icmp,來(lái)監(jiān)測(cè)IP包和ICMP包的傳輸情況,得到的監(jiān)測(cè)結(jié)果如下: 03:17:44:IP:s=10.1.1.2(Ethernet0),d=172.16.1.3(Ethernet0),len 100,rcvd3 03:17:44:ECMR echo reply sent,srcl72.16.1.3,dst 10.1.1.2 03:17:44:IP:s=172.16.1.3(local),d=10.1.12,len 100,unroutable 03:17:46:IP:s=10.1.1.2(Ethernet0),d=172.16.1.3(Ethernet0),len 100,rcvd3 03:17:46:ICMR echo reply sent,src 172.16.1.3,dst 10.1.1.2 03:17:46:IP:s=172.16.1.3(local),d=10.1.1.2,len 100,unroutable 以上監(jiān)測(cè)結(jié)果表明:R3收到了來(lái)自R1的ICMP Echo包,源地址為10.1.1.2,目的地址為172.16.1.3;然后試圖發(fā)送ICMP Echo reply包到10.1.1.2(R1),但是由于不可路由(即結(jié)果中的"unroutable")的原因,此IP包被丟棄,沒(méi)有從R3路由器的任何接口上送出,從而造成R1不能接收到ICMP的應(yīng)答包,導(dǎo)致Ping測(cè)試失敗。 (7)使用trace命令可以顯示IP包在傳輸?shù)倪^(guò)程中的每一個(gè)跳點(diǎn)的IP地址,從而查看IP包所經(jīng)過(guò)的整個(gè)路徑。 (8)路由器的缺省配置是啟動(dòng)IP路由 即可以路由IP包。在第4段中,我們用no ip routing命令關(guān)閉了R1路由器的IP路由功能,然后發(fā)了3個(gè)ping指令,目的地址分別為172.16.1.1、10.1.1.1和10.1.1.2。可以看到前兩個(gè)Ping是成功的,最后一個(gè)則失敗。我們有必要記住這一結(jié)果,它表明了在禁用IP路由的情況下什么是可達(dá),什么不可達(dá)。請(qǐng)注重在Ping指令發(fā)出之前用show ip route命令后的顯示結(jié)果。