欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Ping、Traceroute應用與排錯

這篇文章通過(guò)一個(gè)實(shí)例,演示ping、traceroute、debug等命令的用法;測試網(wǎng)絡(luò )連通性,分析網(wǎng)絡(luò )數據不可達的原因。

___________________________________________

文章目錄

___________________________________________

[*1*].實(shí)例拓撲圖與配置

C1是使用VPCS虛擬出來(lái)的一臺計算機,SW1是一臺不可網(wǎng)管交換機,R1、R2、R3上都添加了”NM-4T”串口,R1上還添加了一個(gè)”NM-1FE-TX”快速以太網(wǎng)端口。R3上面配置了一個(gè)回環(huán)接口3.3.3.3/24,各設備IP配置和連接如下圖:

R1配置如下:

1Router>en
2Router#conf t
3Router(config)#host R1
4R1(config)#line co 0
5R1(config-line)#logg syn
6R1(config-line)#exec-time 0 0
7R1(config-line)#exit
8R1(config)#int fa 1/0
9R1(config-if)#ip add 192.168.1.1 255.255.255.0
10R1(config-if)#no shut
11R1(config-if)#int s 0/0
12R1(config-if)#ip add 12.1.1.1 255.255.255.0
13R1(config-if)#no shut
14R1(config-if)#end
15R1#

R2配置如下:

1Router>en
2Router#conf t
3Router(config)#line co 0
4Router(config-line)#logg syn
5Router(config-line)#exec-time 0 0
6Router(config-line)#exit
7Router(config)#host R2
8R2(config)#int s 0/1
9R2(config-if)#ip add 12.1.1.2 255.255.255.0
10R2(config-if)#no shut
11R2(config-if)#int s 0/2
12R2(config-if)#ip add 23.1.1.2 255.255.255.0
13R2(config-if)#no shut
14R2(config-if)#end
15R2#

R3配置如下:

1Router>en
2Router#conf t
3Router(config)#host R3
4R3(config)#line co 0
5R3(config-line)#logg syn
6R3(config-line)#exec-time 0 0
7R3(config-line)#int s 0/3
8R3(config-if)#ip add 23.1.1.3 255.255.255.0
9R3(config-if)#no shut
10R3(config-if)#exit
11R3(config)#int loopback 0 /*配置回環(huán)接口0*/
12R3(config-if)#ip add 3.3.3.3 255.255.255.0
13R3(config-if)#no shut
14R3(config-if)#end
15R3#

[*2*].測試連通性

首先在C1上面測試ping自己的網(wǎng)關(guān)(R1的fa1/0接口)

1VPCS[1]> ping 192.168.1.1
2192.168.1.1 icmp_seq=1 ttl=255 time=49.000 ms /*可以ping通*/
3 
4/*繼續在C1上測試ping不同網(wǎng)段的地址*/
5 
6VPCS[1]> ping 12.1.1.1
712.1.1.1 icmp_seq=1 ttl=255 time=29.000 ms /*ping網(wǎng)關(guān)上的串口,成功*/
8 
9VPCS[1]> ping 12.1.1.2 /*ping R2和R1相連的接口,失敗,超時(shí)*/
1012.1.1.2 icmp_seq=1 timeout

這一步為什么會(huì )超時(shí)呢?是不是數據包沒(méi)有到達R2?我們在R2上開(kāi)啟debug命令進(jìn)行調試:

1R2#debug ip icmp
2ICMP packet debugging is on
3 
4R2# /*開(kāi)啟調試后,再一次用C1去ping 12.1.1.2,發(fā)現R2上出現了下面的提示*/
5*Mar 1 00:17:10.135: ICMP: echo reply sent, src 12.1.1.2, dst 192.168.1.2
6 
7/*關(guān)閉所有調試的方法是undebug all*/

從上面的顯示可以看出R2收到了C1發(fā)送過(guò)來(lái)的ICMP包,我們查看一下R2的路由表:

1R2#show ip route
2 
3/*省略部分輸出*/
4 
5Gateway of last resort is not set
6 
723.0.0.0/24 is subnetted, 1 subnets
8C 23.1.1.0 is directly connected, Serial0/2
9 12.0.0.0/24 is subnetted, 1 subnets
10C 12.1.1.0 is directly connected, Serial0/1
11 
12R2#
13 
14/*
15 * 從輸出可以明顯的看到R2的路由表中有兩個(gè)直連條目(C)
16 * 發(fā)往23.1.1.0/24網(wǎng)段的數據從Serial0/2發(fā)出
17 * 發(fā)往12.1.1.0/24網(wǎng)段的數據從Serial0/1發(fā)出
18 */

這樣就很清楚的發(fā)現,并沒(méi)有說(shuō)明發(fā)往192.168.1.0/24網(wǎng)段的數據應該怎么發(fā)送,所以R2丟棄發(fā)往192.168.1.2發(fā)送過(guò)來(lái)的數據。

下面給R2添加靜態(tài)路由,讓他知道發(fā)往192.168.1.0/24網(wǎng)段的數據應該發(fā)給12.1.1.1(R1),這樣,C1再ping 12.1.1.2,就能ping通了:

1R2(config)#ip route 192.168.1.0 255.255.255.0 12.1.1.1

這個(gè)時(shí)候實(shí)際上C1 ping R3的任何地址都是ping不通的,因為數據包到達R1后,R1檢查自己的路由表,它會(huì )發(fā)現沒(méi)有任何去往R3的路由條目(3.3.3.0/24、23.1.1.0/24),所以它會(huì )直接給C1回復一個(gè)主機不可達:

1VPCS[1]> ping 3.3.3.3
2*192.168.1.1 icmp_seq=1 ttl=255 time=20.000 ms (ICMP type:3, code:1, Destination host unreachable)
3 
4VPCS[1]> ping 23.1.1.2
5*192.168.1.1 icmp_seq=1 ttl=255 time=20.000 ms (ICMP type:3, code:1, Destination host unreachable)
6 
7VPCS[1]> ping 23.1.1.3
8*192.168.1.1 icmp_seq=1 ttl=255 time=26.000 ms (ICMP type:3, code:1, Destination host unreachable)

在R1上開(kāi)啟ICMP調試就能看到

1R1#debug ip icmp
2ICMP packet debugging is on
3R1#
4*Mar 1 00:34:55.587: ICMP: dst (23.1.1.3) host unreachable sent to 192.168.1.2

要想讓這個(gè)拓撲圖中的各個(gè)設備都能互相ping通,需要在R1、R2、R3上面添加下面的靜態(tài)路由條目:

1/*R1添加一條默認路由目的地是12.1.1.2(R2)*/
2R1(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.2
3 
4/*R2添加下面兩條靜態(tài)路由*/
5R2(config)#ip route 192.168.1.0 255.255.255.0 12.1.1.1
6R2(config)#ip route 3.3.3.0 255.255.255.0 23.1.1.3
7 
8/*R3也添加一條默認路由*/
9R3(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.2

這個(gè)時(shí)候,不論在哪個(gè)設備上,都能ping通拓撲上的所有接口IP。下面是R1上面ping R3回環(huán)接口的返回信息:

1R1#ping 3.3.3.3
2 
3Type escape sequence to abort.
4Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
5!!!!!
6 
7/*
8 * 這里顯示五個(gè)感嘆號,說(shuō)明上面默認ping發(fā)送5次,ping成功5次
9 * 如果超時(shí)會(huì )顯示省略號"....."
10 */

關(guān)閉R3的回環(huán)接口,就會(huì )出現超時(shí)的情況:

1R3#conf t
2R3(config)#int lo 0
3R3(config-if)#shut      /*關(guān)閉R3的回環(huán)接口*/
4R3(config-if)#
5 
6/*使用R1去ping,顯示超時(shí),實(shí)際上這里產(chǎn)生了路由環(huán)路*/
7R1#ping 3.3.3.3
8 
9Type escape sequence to abort.
10Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
11.
12*Mar 1 00:45:09.355: ICMP: time exceeded rcvd from 23.1.1.2.
13 
14/*R2顯示的信息,意思是TTL=0了*/
15*Mar 1 00:45:07.991: ICMP: time exceeded (time to live) sent to 12.1.1.1 (dest was 3.3.3.3)

實(shí)際上這里就是因為R3關(guān)閉了換回接口,R1首先根據自己的默認路由將數據發(fā)送給R2,R2再根據自己的靜態(tài)路由將數據發(fā)送給R3,如果回環(huán)口沒(méi)有關(guān)閉,R3將應答這個(gè)ICMP,但是此時(shí)R3上回環(huán)關(guān)閉了,R3根據自己的默認路由又將數據發(fā)回R2,R2再次將數據發(fā)回R3,這樣直到IP報頭里面的TTL字段減小到0,丟棄這個(gè)數據。

下面我們打開(kāi)R3的lo0回環(huán)接口,關(guān)閉R2的s0/2,再次用R1去ping 3.3.3.3

1/*關(guān)閉R2與R3相連的s0/2接口*/
2R2(config-if)#int s 0/2
3R2(config-if)#shut
4 
5/*R1開(kāi)始ping*/
6R1#ping 3.3.3.3
7 
8Type escape sequence to abort.
9Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
10 
11U   /*這里顯示不可達(U)*/
12 
13*Mar 1 00:53:32.091: ICMP: dst (12.1.1.1) host unreachable rcv from 12.1.1.2
14 
15/*R2上的顯示如下*/
16R2#
17*Mar 1 00:53:34.823: ICMP: dst (3.3.3.3) host unreachable sent to 12.1.1.1
18 
19/*
20 * 查看R2路由表,發(fā)現直連接口條目23.1.1.0/24消失了
21 * 同樣,目的地址是這個(gè)直連接口網(wǎng)段的靜態(tài)路由條目也消失了
22 * 所以R2返回一個(gè)消息告訴R1"(3.3.3.3) host unreachable"
23 */
24R2#show ip route
25 
26Gateway of last resort is not set
27 
2812.0.0.0/24 is subnetted, 1 subnets
29C 12.1.1.0 is directly connected, Serial0/1
30S 192.168.1.0/24 [1/0] via 12.1.1.1

打開(kāi)R2的s0/2繼續下面的實(shí)驗。

[*3*].高級ping命令和路由追蹤命令traceroute

使用高級ping命令,R1 ping R3的回環(huán)接口:

1R1#ping              /*直接輸入ping,回車(chē)*/
2Protocol [ip]:       /*選擇協(xié)議,默認回車(chē)即可*/
3Target IP address: 3.3.3.3    /*選擇目標IP,這里是R3的lo0接口IP*/
4Repeat count [5]: 10          /*ping次數,這里輸入了10次,默認5次*/
5Datagram size [100]:         /*數據包大小,默認回車(chē)即可*/
6Timeout in seconds [2]:      /*超時(shí)時(shí)間,直接回車(chē)*/
7Extended commands [n]: y      /*是否顯示擴展命令,輸入y*/
8Source address or interface: 192.168.1.1 /*選擇用本地的哪個(gè)接口去ping,這里選擇R1的以太網(wǎng)接口*/
9Type of service [0]:         /*下面暫時(shí)不用理會(huì ),一路回車(chē)*/
10Set DF bit in IP header? [no]:
11Validate reply data? [no]:
12Data pattern [0xABCD]:
13Loose, Strict, Record, Timestamp, Verbose[none]:
14Sweep range of sizes [n]:
15Type escape sequence to abort.
16Sending 10, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
17Packet sent with a source address of 192.168.1.1
18!!!!!!!!!!            /*可以看到ping通了十次*/
19Success rate is 100 percent (10/10), round-trip min/avg/max = 16/40/64 ms
20 
21/*高級ping命令能同樣能實(shí)現路由跟蹤*/
22R1#ping
23Protocol [ip]:
24Target IP address: 3.3.3.3
25Repeat count [5]: 1   /*Ping一次*/
26Datagram size [100]:
27Timeout in seconds [2]:
28Extended commands [n]: y   /*使用擴展*/
29Source address or interface: 192.168.1.1 /*選擇源端口*/
30Type of service [0]:
31Set DF bit in IP header? [no]:
32Validate reply data? [no]:
33Data pattern [0xABCD]:
34Loose, Strict, Record, Timestamp, Verbose[none]: r  /*這里輸入r*/
35Number of hops [ 9 ]:
36Loose, Strict, Record, Timestamp, Verbose[RV]:
37Sweep range of sizes [n]:
38 
39/*記錄ICMP包從發(fā)出到返回所經(jīng)過(guò)的端口(外出方向)*/
40Reply to request 0 (96 ms). Received packet has options
41 Total option bytes= 40, padded length=40
42 Record route:
43 (12.1.1.1)  /*首先從R1的這個(gè)接口發(fā)出*/
44 (23.1.1.2)  /*到達R2,R2從這個(gè)接口發(fā)出*/
45 (3.3.3.3)   /*到達目的地*/
46 (23.1.1.3)  /*ICMP包開(kāi)始返回,R3從這個(gè)接口發(fā)回給R2*/
47 (12.1.1.2)  /*到達R2,R2從這個(gè)接口發(fā)給R1*/
48 (192.168.1.1) <*>  /*回到起點(diǎn)*/
49 (0.0.0.0)
50 (0.0.0.0)
51 (0.0.0.0)
52 End of list

ping命令可以測試網(wǎng)絡(luò )通不通,但是如果中間網(wǎng)絡(luò )不通,ping不能很好的定位問(wèn)題出在哪里,而traceroute可以很好的定位問(wèn)題出現的位置,下面是正常狀態(tài)下traceroute 3.3.3.3的結果

1R1#traceroute 3.3.3.3
2 
3Type escape sequence to abort.
4Tracing the route to 3.3.3.3
5 
61 12.1.1.2 40 msec 24 msec 40 msec
7 2 23.1.1.3 28 msec 48 msec *
8 
9/*
10 * 可以看到數據首先經(jīng)過(guò)了12.1.1.2,然后到達23.1.1.3
11 * 3.3.3.3和23.1.1.3同處于R3上,所以追蹤到此完成
12 */

* Traceroute的工作原理:

首先,發(fā)送設備將數據包中的TTL設置成1,數據包會(huì )被第一條路由器丟棄,返回一個(gè)錯誤碼信息,設備源根據這個(gè)信息判斷經(jīng)過(guò)的中間設備和延時(shí),設備源一般發(fā)送三個(gè)重復的包(這就是為什么每個(gè)IP后面有3個(gè)返回時(shí)間的原因”12.1.1.2 40 msec 24 msec 40 msec”);之后設備源接著(zhù)發(fā)送TTL為2的數據包,再發(fā)送TTL為3的數據包,直到數據包達到目的地或者TTL=30為止。在正常情況下,除非路由存在環(huán)路,否則TTL不會(huì )超過(guò)30就到達目的地。

在PC(Windows設備)CMD下,命令是tracert:

1PC> tracert 3.3.3.3 -d
2traceroute to 3.3.3.3, 64 hops max, press Ctrl+C to stop
3 1 192.168.1.1 18.000 ms 9.000 ms 9.000 ms
4 2 12.1.1.2 39.000 ms 29.000 ms 29.000 ms
5 3 *23.1.1.3 58.000 ms (ICMP type:3, code:3, Destination port unreachable)
6 
7/*
8 * 可以看到最后一個(gè)包返回了一個(gè)端口不可達,
9 * 其實(shí)源設備就是利用返回的是錯誤碼,還是端口不可達判斷是否到達了目的主機。
10 * 如果是端口不可達,就說(shuō)明到達了主機
11 * 詳見(jiàn)"TCP/IP詳解 卷一:協(xié)議"
12 */

[*4*].常用排錯命令

1/*針對某接口,以太網(wǎng)接口可以看到MAC地址,帶寬,IP地址等*/
2R1#show interfaces fa 1/0
3FastEthernet1/0 is up, line protocol is up
4 Hardware is AmdFE, address is cc00.143c.0010 (bia cc00.143c.0010)
5 Internet address is 192.168.1.1/24
6 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
7 reliability 255/255, txload 1/255, rxload 1/255
8 Encapsulation ARPA, loopback not set

 

1/*查看接口是否開(kāi)啟*/
2R1#show ip interface brief
3Interface IP-Address OK? Method Status Protocol
4Serial0/0 12.1.1.1 YES manual up up
5Serial0/1 unassigned YES unset administratively down down
6Serial0/2 unassigned YES unset administratively down down
7Serial0/3 unassigned YES unset administratively down down
8FastEthernet1/0 192.168.1.1 YES manual up up

 

1/*查看路由器IOS版本,硬件信息等*/
2R1#show version

 

1/*查看路由器接口硬件信息*/
2R1#show controllers fa 1/0

 

1/*
2 * 查看路由器接口硬件信息,
3 * 如果是串行接口可以看到如下一行,可以判斷接口是DCE端還是DTE端還有時(shí)鐘
4 * cable type : V.11 (X.21) DCE cable, received clockrate 2015232
5 */
6R1#show controllers s 1/0

 

1/*查看路由器ARP緩存*/
2R1#show arp
3Protocol Address Age (min) Hardware Addr Type Interface
4Internet 192.168.1.1 - cc00.143c.0010 ARPA FastEthernet1/0
5Internet 192.168.1.2 42 0050.7966.6800 ARPA FastEthernet1/0

————————————————————————————————————

[**] 注:如文中未特別聲明轉載請注明出自: QingSword.COM

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
ping和traceroute原理分析
試試這個(gè)命令,比ping還好用
網(wǎng)絡(luò )設備排障怎么破?這五個(gè)命令申請出戰!
卡卡筆記之Linux網(wǎng)絡(luò )管理----命令詳解 - Kachy - 51CTO技術(shù)博客
運維之思科篇-NAT基礎配置
路由器------邏輯端口
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久