国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 網(wǎng)絡(luò)通信 > 正文

靜態(tài)路由的設(shè)置及相關(guān)命令

2019-11-05 00:34:48
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

    本節(jié)主要是通過(guò)靜態(tài)路由設(shè)置的實(shí)驗(yàn)幫助讀者深入地體會(huì)路由的概念,并切實(shí)把握靜態(tài)路由的設(shè)置、查看路由表、設(shè)置無(wú)類路由等常用的命令。
  
    1.實(shí)驗(yàn)?zāi)康?/B>
  
    通過(guò)本實(shí)驗(yàn),讀者可以把握以下技能:
    設(shè)置靜態(tài)路由
    設(shè)置啟用路由器的路由功能
    查看路由表
    ping和trace命令的使用
    
    2.設(shè)備需求
  
    3臺(tái)Cisco路由器,其中1臺(tái)具有2個(gè)以太網(wǎng)接口,其余2臺(tái)至少具有1個(gè)以太網(wǎng)接口;
    2臺(tái)Hub,4條雙絞線 (也可以用2條交叉網(wǎng)線直接把3臺(tái)路由器連接起來(lái))
    1臺(tái)終端服務(wù)器,如cisco 2509路由器,及用于反向Telnet的相應(yīng)線纜;
    1臺(tái)帶有超級(jí)終端程序的PC機(jī),以及Console電纜及轉(zhuǎn)接器。
  
    3.拓?fù)浣Y(jié)構(gòu)及配置說(shuō)明
  
    本實(shí)驗(yàn)的拓?fù)浣Y(jié)構(gòu)如圖4-2所示。
  

    3臺(tái)路由器分別命名為R1、R2和R3,所使用的接口和相應(yīng)的    實(shí)驗(yàn)中,應(yīng)使用靜態(tài)路由的設(shè)置。實(shí)現(xiàn)R2到R3在IP層的連通性,即要求從R2可以ping通R3,反之亦然。
  
    4.實(shí)驗(yàn)配置及監(jiān)測(cè)結(jié)果
  
    首先,根據(jù)拓?fù)浣Y(jié)構(gòu)圖的要求,正確配置各路由器的以太網(wǎng)接口。
    接下來(lái)的實(shí)驗(yàn)記錄是從接口的配置工作完成之后開(kāi)始的,具體內(nèi)容見(jiàn)配置清單4-1。
  
    配置清單4-1配置和監(jiān)測(cè)靜態(tài)路由
    
    第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é)果。


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 桑日县| 灵山县| 滨海县| 金溪县| 鄄城县| 隆回县| 宝清县| 临西县| 巴青县| 梁山县| 定安县| 泗水县| 穆棱市| 鹿邑县| 靖安县| 普陀区| 凤翔县| 通许县| 和政县| 云浮市| 河津市| 恩施市| 阳新县| 济南市| 岑溪市| 得荣县| 昭觉县| 阳信县| 沙雅县| 龙陵县| 乐昌市| 延寿县| 台中市| 建德市| 曲沃县| 桃江县| 贡山| 兴义市| 金堂县| 和龙市| 南澳县|