《路由交换技术》实验指导书.doc
【精品文档】如有侵权,请联系网站删除,仅供学习与交流路由交换技术实验指导书.精品文档. 网络高级应用技术实 验 指 导 书邵雪梅 编 写适用专业: 计算机网络技术 滁州学院计算机科学与技术系2009 年 8 月前 言本课程的基本内容介绍,通过学习学生需要掌握的基本知识。为了使学生更好地理解和深刻地把握这些知识,并在此基础上,训练和培养哪些方面的技能,设置的具体实验项目,其中哪几项实验为综合性、设计性实验。各项实验主要了解、掌握的具体知识,训练及培养的技能。本指导书的特点。对不同专业选修情况说明。实验一路由器基本配置-4实验二静态路由配置-8实验三RIP路由协议配置-11实验四IGRP路由协议配置-15实验五EIGRP路由协议配置-18实验六OSPF路由协议配置-21实验七Cisco IOS操作-24实验八路由器口令恢复-27实验九交换机基本配置-29实验十生成树协议-35实验十一综合实验 VLAN配置与中继-37实验十二综合实验 VLAN间路由-42实验十三三层交换实验-45实验十四综合NAT-49实验十五路由器DHCP配置-52实验十六综合实验 访问控制列表-54实验十七综合实验 故障检测-57实验一 路由器基本配置实验学时:2实验类型:验证一、实验目的 掌握路由器在网络中的作用、组成以及路由器设备选型; 掌握PacketTrace 仿真软件的使用方法; 练掌握路由器的基本配置命令,包括路由器名称设定、保护口令设定、口令封装、接口描述、查看命令等。二、实验条件 Cisco2621 Router、PacketTrace仿真软件、具备Windows操作系统的PC机三、实验原理及相关知识 掌握PacketTrace路由仿真软件的使用、路由器基本配置四、实验步骤PacketTrace仿真软件介绍路由、交换仿真软件就是对真实的路由器、交换机等网络设备进行软件模拟,可以在安装仿真软件的普通PC上进行网络设备的配置、管理以及网络规划、网络验证等工作,而不需要真实的网络设备。目前,市场上路由、交换等网络设备模拟软件有很多种,比较优秀的有Boson、RouterSim、CIM等。其中PacketTrace是目前最流行的,最接近真实环境的模拟软件。可以说,PacketTrace软件是真实设备的缩影。PacketTrace 使用打开PacketTrace软件,选择“Custom Made Devices”中的2621XM系列路由器。再选择“Connections”连接线中的“Serial DCE” 连接线,按照如图路由器的方式连接好路由器。 然后,按照图示连接好交换机和主机。路由器配置1.路由器配置模式及其转换 用户模式(user mode) router>用户模式(user mode):该模式下只能查看路由器基本状态和普通命令,不能更改路由器配置。此时路由器名字后跟一个“>”符号,表明是在用户模式下。如:router> 特权模式(privileged mode) router#特权模式(privileged mode):该模式下可查看各种路由器信息及修改路由器配置。在用户模式下以enable命令登陆,此时“>”将变成“#”,表明是在privileged mode .如:router# 全局配置模式(golbal configuration mode): router(config)#全局配置模式(golbal configuration mode):该模式下可进行更高级的配置,并可由此模式进入各种配置子模式。其提示符如:router(config)# 从各模式下返回,只要不断输入exit即可2.按照地址表配置路由器各接口的地址信息 配置路由器ARouter>en/进入特权模式Router#config t/进入全局模式Router(config)#hostname LabA/设置主机名Lab_A(config)#enable secret todd/设置加密口令,由用户模式进入特权模式起作用。Lab_A(config)#interface fa0/0/进入Fastethernet 0/0子接口模式Lab_A(config-if)#ip address 192.168.10.1 255.255.255.0 /配置Fa0/0接口的IP地址Lab_A(config-if)#description Lab_A LAN Connection/配置Fa0/0接口的描述字符Lab_A(config-if)#no shut/激活Fa0/0接口Lab_A(config-if)#interface serial 0/0/进入serial 0/0子接口模式Lab_A(config-if)#ip address 192.168.20.1 255.255.255.0 /配置serial 0/0接口的IP地址Lab_A(config-if)#description WAN Connection to Lab_B/配置serial 0/0接口的描述字符Lab_A(config-if)#no shut/激活serial 0/0接口Lab_A(config-if)#exit/退出子接口模式,返回全局模式Lab_A(config)#line console 0/进入Console子接口模式Lab_A(config-line)#password todd/配置Console登陆密码Lab_A(config-line)#loginLab_A(config-line)#line vty 0 4/进入Vty子接口模式Lab_A(config-line)#password todd/配置Vty登陆密码,可以有五个TelnetLab_A(config-line)#loginLab_A(config-line)#exit/退出子接口模式,返回全局模式Lab_A(config)#banner motd #/设置Banner信息,以字符“#”结束输入This is the Lab_A routerLab_A(config)#z/即Ctrl+Z的组合键,可直接返回特权模式Lab_A#copy running-config startup-config/保存上面所做的所有配置Destination filename startup-config? EnterLab_A#/特权模式查看当前路由器配置Lab_A#show running-config 配置路由器BRouter>enRouter#config tRouter(config)#hostname LabBLab_B(config)#enable secret toddLab_B(config)#interface fa0/0Lab_B(config-if)#ip address 192.168.30.1 255.255.255.0Lab_B(config-if)#description Lab_B LAN ConnectionLab_B(config-if)#no shutLab_B(config-if)#interface serial 0/0Lab_B(config-if)#ip address 192.168.20.2 255.255.255.0Lab_B(config-if)#description WAN Connection to Lab_ALab_B(config-if)#clock rate 64000Lab_B(config-if)#no shutLab_B(config-if)#interface serial 0/1Lab_B(config-if)#ip address 192.168.40.1 255.255.255.0Lab_B(config-if)#description WAN Connection to Lab_CLab_B(config-if)#clock rate 64000Lab_B(config-if)#no shutLab_B(config-if)#exitLab_B(config)#line console 0Lab_B(config-line)#password toddLab_B(config-line)#loginLab_B(config-line)#line vty 0 4Lab_B(config-line)#password toddLab_B(config-line)#loginLab_B(config-line)#exitLab_B(config)#banner motd #This is the Lab_B routerLab_B(config)#zLab_B#copy running-config startup-configDestination filename startup-config? Enter查看当前路由器配置Lab_B#show running-config 配置路由器C Router>enRouter#config tRouter(config)#hostname LabCLab_C(config)#enable secret toddLab_C(config)#interface fa0/0Lab_C(config-if)#ip address 192.168.50.1 255.255.255.0Lab_C(config-if)#description Lab_C LAN ConnectionLab_C(config-if)#no shutLab_C(config-if)#interface serial 0/0Lab_C(config-if)#ip address 192.168.40.2 255.255.255.0Lab_C(config-if)#description WAN Connection to Lab_BLab_C(config-if)#no shutLab_C(config-if)#exitLab_C(config)#line console 0Lab_C(config-line)#password toddLab_C(config-line)#loginLab_C(config-line)#line vty 0 4Lab_C(config-line)#password toddLab_C(config-line)#loginLab_C(config-line)#exitLab_C(config)#banner motd #This is the Lab_C routerLab_C(config)# zLab_C#copy running-config startup-configDestination filename startup-config? Enter查看当前路由器配置Lab_C#show running-config配置主机的IP地址每台主机的IP地址信息配置:网关:连接为PC机的路由器F0/0接口的IP地址,如PC0的网关为192.168.10.1IP地址:与网关在同一个子网,PC0的IP地址可为192.168.10.2测试: 在主机上ping各自网关,查看结果然后主机间相互测试,查看结果。常用路由器状态查询命令(在特权模式下输入命令)show version /查看IOS版本号,已启动时间,flash中的IOS的文件名,router里面共有什么的端口,寄存器的值等等。show flash /查看flash中的内容,IOS的长度,文件名,剩余空间,总空间。show running-config /查看路由器当前的配置信息。show startup-config /查看nvram 中的路由器配置信息。show interface /查看路由器上的各个端口的状态信息。(很多重要信息)show controller s0 /查看s0是DCE口还是DTE口show ip route /查看路由器的路由配置情况五、思考题及其它 配置实验图中每台主机的IP地址信息,包括IP地址取值、子网掩码、网关等;考虑实验中配置的4个密码之间的关系和各自的用途;路由器串行接口连接的DCE端口的作用;图中各设备连接的连接线缆的型号和连接规律。实验二 静态路由配置实验学时:2 实验类型:验证一、实验目的 掌握路由器在网络中的作用、组成以及路由器设备选型; 掌握PacketTrace 仿真软件的使用方法; 掌握路由器的静态路由配置命令。二、实验条件 Cisco2621 Router、PacketTrace仿真软件、具备Windows操作系统的PC机三、实验原理及相关知识 掌握PacketTrace路由仿真软件的使用、路由静态路由配置四、实验步骤1. 路由器路由信息配置 配置之前路由器A的路由信息Lab_A#sh ip route/特权模式下,查看路由表命令Codes: C - connected, S - static, I - IGRP, R - RIP,M - mobile, B BGP D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area N1 - OSPF NSS external type1, N2 - OSPF NSSA external type 2 E1 - OSPF externaltype 1, E2 - OSPF external type 2, E EGP i - IS-IS,L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidatedefault, U - per-user static route, o - ODR, P -periodic downloaded static route, T - trafficengineered routeGateway of last resort is not setC 192.168.10.0/24 is directly connected, FastEthernet0/0C 192.168.20.0/24 is directly connected, Serial 0/0 配置之前路由器B的路由信息Lab_B#sh ip routeoutput cutGateway of last resort is not setC 192.168.20.0/24 is directly connected, Serial0/0C 192.168.40.0/24 is directly connected, Serial0/1C 192.168.30.0 is directly connected FastEthernet 0/0 配置之前路由器C的路由信息Lab_C#sh ip routeoutput cutGateway of last resort is not setC 192.168.50.0/24 is directly connected, FastEthernet0/0C 192.168.40.0/24 is directly connected, Serial0/02. 配置路由器路由 配置路由器A路由Lab_A(config)#ip route 192.168.30.0 255.255.255.0 192.168.20.2 Lab_A(config)#ip route 192.168.40.0 255.255.255.0 192.168.20.2Lab_A(config)#ip route 192.168.50.0 255.255.255.0 192.168.20.2/ip route 目的网络 子网掩码 下一跳地址 配置之后路由器A的路由信息Lab_A#sh ip routeoutput cutS 192.168.50.0 1/0 via 192.168.20.2S 192.168.40.0 1/0 via 192.168.20.2S 192.168.30.0 1/0 via 192.168.20.2C 192.168.20.0 is directly connected, Serial 0/0C 192.168.10.0 is directly connected, FastEthernet0/0 配置路由器B路由Lab_B(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1Lab_B(config)#ip route 192.168.50.0 255.255.255.0 192.168.40.2 配置之后路由器B的路由信息Lab_B#sh ip routeoutput cutS 192.168.50.0 1/0 via 192.168.40.2C 192.168.40.0 is directly connected, Serial0/1C 192.168.30.0 is directly connected, FastEthernet 0/0C 192.168.20.0 is directly connected, Serial0/0S 192.168.10.0 1/0 via 192.168.20.1 配置路由器C路由Lab_C(config)#ip route 192.168.30.0 255.255.255.0 192.168.40.1Lab_C(config)#ip route 192.168.20.0 255.255.255.0 192.16.40.1Lab_C(config)#ip route 192.168.10.0 255.255.255.0 192.168.40.1 配置之后路由器A的路由信息Lab_A#sh ip routeoutput cutC 192.168.50.0 is directly connected, FastEthernet0/0C 192.168.40.0 is directly connected, Serial0/0S 192.168.30.0 1/0 via 192.168.40.1S 192.168.20.0 1/0 via 192.168.40.1S 192.168.10.0 1/0 via 192.168.40.1在路由器B、C特权模式下使用show ip route 命令,查看路由器B、C的路由信息。3. 测试连通性 路由器A ping路由器CLab_A#ping 192.168.50.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.50.1, timeout is 2 seconds:Success rate is 80 percent (4/5), round-trip min/avg/max = 64/66/68 msLab_A# 路由器C ping路由器ALab_C#ping 192.168.10.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:Success rate is 100 percent (5/5), round-trip min/avg/max = 64/67/72 ms 主机在各主机间使用ping命令,测试主机间的连通性。4. 常用路由器状态查询命令(在特权模式下输入命令)show version /查看IOS版本号,已启动时间,flash中的IOS的文件名,router里面共有什么的端口,寄存器的值等等。show protocol /显示与IP 有关的路由协议信息。各个端口的情况。show flash /查看flash中的内容,IOS的长度,文件名,剩余空间,总空间。show running-config /查看路由器当前的配置信息。show startup-config /查看nvram 中的路由器配置信息。show controller s0 /查看s0是DCE口还是DTE口show ip route /查看路由器的路由配置情况show hosts /查看IP host 表五、思考题及其它 在主机上利用Ping命令测试主机间连通性; 图中各设备连接的连接线缆的型号和连接规律。实验三 RIP路由协议配置实验学时:2实验类型:验证一、实验目的 掌握RIP协议分类、基本工作原理; 掌握RIP协议配置方法。二、实验条件 Cisco2621 Router、PacketTrace仿真软件、具备Windows操作系统的PC机三、实验原理及相关知识 RIP协议配置方法四、实验步骤RIP协议路由选择信息协议)是距离矢量选择协议的一种,它具有如下特点: 选用跳数做为唯一的路由选择度量; 跳数允许的最大值是15,如果路由器收到了一个跳数值为16 的路由更新信息,则其目标网络是不可达的; 缺省情况下,每30s 广播一次路由更新数据;RIP 协议包含有两个版本,RIP 第一版和RIP 第二版.1.RIPv1 的特点包括:1)使用跳数(hop count)作为度量值来决定最佳路径2)允许最大跳数是15 跳3)默认是每30 秒广播路由更新(实际环境中并不是设定的固定为30 秒,而是25秒到30 秒之间的随机时间,防止两个路由器发送同时更新产生冲突)4)最多支持6 条等价链路的负载均衡,默认是4 条5)是基于类的路由协议,不支持VLSM6)不支持验证(authentication)路由信息配置1. 路由器路由信息配置 配置之前路由器A的路由信息Lab_A#sh ip route/特权模式下,查看路由表命令Codes: C - connected, S - static, I - IGRP, R - RIP,M - mobile, B BGP D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area N1 - OSPF NSS external type1, N2 - OSPF NSSA external type 2 E1 - OSPF externaltype 1, E2 - OSPF external type 2, E EGP i - IS-IS,L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidatedefault, U - per-user static route, o - ODR, P -periodic downloaded static route, T - trafficengineered routeGateway of last resort is not setC 192.168.10.0/24 is directly connected, FastEthernet0/0C 192.168.20.0/24 is directly connected, Serial 0/0 配置之前路由器B的路由信息Lab_B#sh ip routeoutput cutGateway of last resort is not setC 192.168.20.0/24 is directly connected, Serial0/0C 192.168.40.0/24 is directly connected, Serial0/1C 192.168.30.0 is directly connected FastEthernet 0/0 配置之前路由器C的路由信息Lab_C#sh ip routeoutput cutGateway of last resort is not setC 192.168.50.0/24 is directly connected, FastEthernet0/0C 192.168.40.0/24 is directly connected, Serial0/02. 配置路由器路由 配置路由器A路由Lab_A(config)#router ripLab_A(config-router)#network 192.168.10.0Lab_A(config-router)#network 192.168.20.0Lab_A(config-router)#Z/ip route 目的网络 子网掩码 下一跳地址 配置路由器B路由Lab_B(config)#router ripLab_B(config-router)#network 192.168.20.0Lab_B(config-router)#network 192.168.30.0Lab_B(config-router)#network 192.168.40.0Lab_B(config-router)#Z 配置路由器C路由Lab_C(config)#router ripLab_C(config-router)#network 192.168.40.0Lab_C(config-router)#network 192.168.50.0Lab_C(config-router)#Z 配置之后路由器A的路由信息Lab_A#sh ip routeoutput cutR 192.168.50.0 120/2 via 192.168.20.2, 00:00:23, Serial0/0R 192.168.40.0 120/1 via 192.168.20.2, 00:00:23, Serial0/0R 192.168.30.0 120/1 via 192.168.20.2, 00:00:23, Serial0/0C 192.168.20.0 is directly connected, Serial0/0C 192.168.10.0 is directly connected, FastEthernet0/0 配置之后路由器B的路由信息Lab_B#sh ip routeoutput cutR 192.168.50.0 120/1 via 172.16.40.2, 00:00:11, Serial0/1C 192.168.40.0 is directly connected, Serial0/1C 192.168.30.0 is directly connected, FastEthernet0/0C 192.168.20.0 is directly connected, Serial0/0R 192.168.10.0 120/1 via 172.16.20.1, 00:00:21, Serial0/0 配置之后路由器C的路由信息Lab_C#sh ip routeoutput cutGateway of last resort is not setC 192.168.50.0 is directly connected, FastEthernet0/0C 192.168.40.0 is directly connected, Serial0/0R 192.168.30.0 120/1 via 192.168.40.1, 00:00:04, Serial0/0R 192.168.20.0 120/1 via 192.168.40.1, 00:00:26, Serial0/0R 192.168.10.0 120/2 via 192.168.40.1, 00:00:04, Serial0/03. 测试连通性 路由器A ping路由器CLab_A#ping 192.168.50.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.50.1, timeout is 2 seconds:Success rate is 80 percent (4/5), round-trip min/avg/max = 64/66/68 msLab_A# 路由器C ping路由器ALab_C#ping 192.168.10.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:Success rate is 100 percent (5/5), round-trip min/avg/max = 64/67/72 ms 主机在各主机间使用ping命令,测试主机间的连通性。4. 常用路由器状态查询命令(在特权模式下输入命令)show version /查看IOS版本号,已启动时间,flash中的IOS的文件名,router里面共有什么的端口,寄存器的值等等。show protocol /显示与IP 有关的路由协议信息。各个端口的情况。show flash /查看flash中的内容,IOS的长度,文件名,剩余空间,总空间。show running-config /查看路由器当前的配置信息。show startup-config /查看nvram 中的路由器配置信息。show interface /查看路由器上的各个端口的状态信息。(很多重要信息)show controller /查看接口控制器的状态,可看到连接的是DTE还是DCEshow history /查看history buffer 里面的命令列表show controller s0 /查看s0是DCE口还是DTE口show ip route /查看路由器的路由配置情况show hosts /查看IP host 表五、思考题及其它 在主机上利用Ping命令测试主机间连通性; 图中各设备连接的连接线缆的型号和连接规律。实验四 IGRP路由协议配置实验学时:2 实验类型:综合一、实验目的 掌握IGRP协议分类、基本工作原理; 掌握IGRP协议配置方法。二、实验条件 Cisco2621 Router、PacketTrace仿真软件、具备Windows操作系统的PC机三、实验原理及相关知识 IGRP协议配置方法四、实验步骤1. 路由器路由信息配置 配置之前路由器A的路由信息Lab_A#sh ip route/特权模式下,查看路由表命令Codes: C - connected, S - static, I - IGRP, R - RIP,M - mobile, B BGP D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area N1 - OSPF NSS external type1, N2 - OSPF NSSA external type 2 E1 - OSPF externaltype 1, E2 - OSPF external type 2, E EGP i - IS-IS,L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidatedefault, U - per-user static route, o - ODR, P -periodic downloaded static route, T - trafficengineered routeGateway of last resort is not setC 192.168.10.0/24 is directly connected, FastEthernet0/0C 192.168.20.0/24 is directly connected, Serial 0/0 配置之前路由器B的路由信息Lab_B#sh ip routeoutput