摩登 2007-11-4 10:56
静态路由的设置及相关命令
本节主要是通过静态路由设置的实验帮助读者深入地体会路由的概念,并切实掌握静态路由的设置、查看路由表、设置无类路由等常用的命令。
1.实验目的
通过本实验,读者可以掌握以下技能:
设置静态路由
设置启用[url=http://www.baidu.com/baidu?tn=jkday2000&word=路由器]路由器[/url]的路由功能
查看路由表
ping和trace命令的使用
2.设备需求
3台[url=http://tech.haoxz.com/sort/1053/index.html]Cisco路由器[/url],其中1台具有2个[url=http://tech.haoxz.com/sort/1036/index.html]以太网[/url]接口,其余2台至少具有1个以太网接口;
2台Hub,4条双绞线 (也可以用2条交叉网线直接把3台路由器连接起来)
1台终端[url=http://tech.haoxz.com/sort/3031/index.html]服务器[/url],如cisco 2509路由器,及用于反向Telnet的相应线缆;
1台带有超级终端程序的PC机,以及Console电缆及转接器。
3.拓扑结构及[url=http://tech.haoxz.com/sort/1108/index.html]配置[/url]说明
本实验的拓扑结构如图4-2所示。
[url=http://tech.haoxz.com/ArtImage/20070903/wj1487_1.jpg][img=500,287]http://tech.haoxz.com/ArtImage/20070903/wj1487_1.jpg[/img][/url]
3台路由器分别命名为R1、R2和R3,所使用的接口和相应的[url=http://tech.haoxz.com/sort/1137/index.html]IP地址[/url]分配如图4.2中的标注。图中的"/24"表示[url=http://tech.haoxz.com/sort/1032/index.html]子网掩码[/url]为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:
!!!!!
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,切换回终端服务器)
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