本節主要是通過靜態路由設置的實驗幫助讀者深入地體會路由的概念,并切實掌握靜態路由的設置、查看路由表、設置無類路由等常用的命令。
1.實驗目的
通過本實驗,讀者可以掌握以下技能:
設置靜態路由
設置啟用路由器的路由功能
查看路由表
ping和trace命令的使用
2.設備需求
3臺Cisco路由器,其中1臺具有2個以太網接口,其余2臺至少具有1個以太網接口;
2臺Hub,4條雙絞線 (也可以用2條交叉網線直接把3臺路由器連接起來)
1臺終端服務器,如cisco 2509路由器,及用于反向Telnet的相應線纜;
1臺帶有超級終端程序的PC機,以及Console電纜及轉接器。
3.拓撲結構及配置說明
本實驗的拓撲結構如圖4-2所示。
3臺路由器分別命名為R1、R2和R3,所使用的接口和相應的IP地址分配如圖4.2中的標注。圖中的"/24"表示子網掩碼為24位,即255.255.255.0。
實驗中,應使用靜態路由的設置。實現R2到R3在IP層的連通性,即要求從R2可以ping通R3,反之亦然。
4.實驗配置及監測結果
首先,根據拓撲結構圖的要求,正確配置各路由器的以太網接口。
接下來的實驗記錄是從接口的配置工作完成之后開始的,具體內容見配置清單4-1。
配置清單4-1配置和監測靜態路由
第1段:測試基本的連通性
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:
!!!!!
Suclearcase/" target="_blank" >ccess 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,切換回終端服務器)
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段:加入靜態路由并測試連通性
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,切換回終端服務器)
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切換回終端服務器)
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