1、计算机网络上机任务书实验三 网络互联之路由器配置一实验目的:熟悉路由器工作原理练习cisco 路由器端口的基本配置掌握静态路由的配置掌握动态路由协议的配置二、实验任务(一)静态路由设置(二)动态路由 RIP 协议设置(二) *动态路由 OSPF 协议设置(四) *路由器综合配置实验=(一)静态路由设置一、实验目标掌握静态路由的配置方法和技巧;掌握通过静态路由方式实现网络的连通性;熟悉广域网线缆的连接方式;二、实验背景学校有新旧两个校区,每个校区是一个独立的局域网,为了使新旧校区能够正常相互通讯,共享资源,每个校区出口利用一台路由器进行连接,两台路由器间学校申请了一条 2M 的 DDN 专线进行
2、相连,要求做适当配置实现两个校区间的正常相互访问。三、技术原理路由器属于网络层设备,能够根据 IP 包头的信息,选择一条最佳路径将数据包转发出去,实现不同网段的主机之间的互相访问。路由器是根据路由表进行选路和转发的,而路由表就是由一条条路由信息组成。生成路由表主要有两种方法:手工配置和动态配置,即静态路由协议配置和动态路由协议配置。静态路由是指由网络管理员手工配置的路由信息。静态路由除了具有简单、高效、可靠的优点外,它的另一个好处是网络安全保密性高。缺省路由可以看作是静态路由的一种特殊情况。当数据在查找路由表时,没有找到和目标相匹配的路由表项时,为数据指定的路由。四、配置过程1、实验拓扑1、在
3、路由器 R1、R2 上配置接口的 IP 地址和 R1 串口上的时钟频率;2、查看路由器生成的直连路由;3、在路由器 R1、R2 上配置静态路由;4、验证 R1、R2 上的静态路由配置;5、将 PC1、PC2 主机默认网关分别设置为与路由器接口 f1/0 IP 地址;6、PC1、PC2 主机之间可以互相通信;7、CISCO 路由器静态路由的配置命令为:(config)#ip route net-number mask next-hopnet-number: 网络号mask: 掩码 next-hop: 下一跳出口 IP 地址例:(config)# ip route 192.168.2.0 255.
4、255.255.0 192.168.5.3 /添加静态路由(config)#ip route 0.0.0.0 0.0.0.0 192.168.5.3 /添加默认路由8、路由器添加串行接口:在模拟器 physical 界面,先点那个绿色开关,表示关闭电源,然后从左边拖拽 WIC-1T 或者 WIC-2T 到路由器的插槽中去,然后开启电源即可。 9、路由器无法设置时钟速率:只有用串口相连的设备才能在 DCE(数据通讯设备)端设置时钟频率,Packet Tracer 需要添加串口模块,然后用串行线相连,在 DCE 端会显示一个很小的时钟,标明需要配置时钟频率。 (以太网 E 口 F 口都不能配置时钟
5、频率,只有 S 口可以配置)2、配置步骤 路由器 R1 配置:RouterRouterenRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R1R1(config)#interface fa1/0 /配置以太网接口;或(config)#int fa0/1 下同 R1(config-if)#no shutdown %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up%LINEPRO
6、TO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to upR1(config-if)#ip address 192.168.1.1 255.255.255.0 /配置以太网口 IP 地址及掩码R1(config-if)#exitR1(config)#interface serial 2/0 /配置串口 2 或#interface serial 0/2 下同R1(config-if)#no shutdown /激活端口%LINK-5-CHANGED: Interface Serial2/0, chang
7、ed state to downR1(config-if)#clock rate 64000 /配置串口时间频率为 64000;(设置同步时间,保证数据传输的同步,双绞线用的是以太网端口接内部网络,串口主要用于连接外部网络,因为要协调时间,所以一般在接外部网络的一段,要设同步时间)R1(config-if)#ip address 192.168.5.2 255.255.255.0 /配置串口 IP 地址及掩码R1(config-if)#end%SYS-5-CONFIG_I: Configured from console by consoleR1#show ip route /查看路由表Cod
8、es: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS leve
9、l-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, FastEthernet1/0 /直连网络R1#%LINK-5-CHANGED: Interface Serial2/0, changed state to up%LINEPROTO-5-UPDOWN: Line p
10、rotocol on Interface Serial2/0, changed state to upR1#show ip route /查看路由表Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2
11、- OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, FastEthernet1/0 /以太网口直连路由C 192.
12、168.5.0/24 is directly connected, Serial2/0 /串口直连网络R1#conf tEnter configuration commands, one per line. End with CNTL/Z.R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.5.3 /添加静态路由R1(config)#endR1#%SYS-5-CONFIG_I: Configured from console by consoleR1#show ip route /查看路由表 Codes: C - connected, S
13、 - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inte
14、r area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, FastEthernet1/0 /直连网络S 192.168.2.0/24 1/0 via 192.168.5.3 /通过串口连接的网络 192.168.2.0C 192.168.5.0/24 is directly connected, Serial2/
15、0 /直连网络R1# 路由器 R2 配置:RouterenRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R2R2(config)#interface fa1/0R2(config-if)#no shutdown %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEther
16、net1/0, changed state to upR2(config-if)#ip address 192.168.2.1 255.255.255.0R2(config-if)#exitR2(config)#interface serial 2/0R2(config-if)#no shutdown %LINK-5-CHANGED: Interface Serial2/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to upR2(config-if)
17、#ip address 192.168.5.3 255.255.255.0R2(config-if)#endR2#%SYS-5-CONFIG_I: Configured from console by consoleR2#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF
18、 NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.2.0/24 is
19、directly connected, FastEthernet1/0C 192.168.5.0/24 is directly connected, Serial2/0R2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.5.2 /添加静态路由R2(config)#end%SYS-5-CONFIG_I: Configured from console by consoleR2#show ip route
20、Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS l
21、evel-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setS 192.168.1.0/24 1/0 via 192.168.5.2 /通过串口连接的网络 192.168.1.0C 192.168.2.0/24 is directly connected, FastEthernet1/0 /直连网络C 192.168.5.0/24 is direc
22、tly connected, Serial2/0 /直连网络R2#3、连通性测试Packet Tracer PC Command Line 1.0PCipconfigIP Address: 192.168.1.2Subnet Mask.: 255.255.255.0Default Gateway.: 192.168.1.1PCping 192.168.2.2Pinging 192.168.2.2 with 32 bytes of data:Request timed out.Reply from 192.168.2.2: bytes=32 time=17ms TTL=126Reply from
23、 192.168.2.2: bytes=32 time=21ms TTL=126Reply from 192.168.2.2: bytes=32 time=16ms TTL=126Ping statistics for 192.168.2.2:Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),Approximate round trip times in milli-seconds:Minimum = 16ms, Maximum = 21ms, Average = 18msPC=(二)动态路由 RIP 协议设置一、实验目标掌握 RIP 协
24、议的配置方法;掌握查看通过动态路由协议 RIP 学习产生的路由;熟悉广域网线缆的连接方式;二、实验背景假设校园网通过一台三层交换机连到校园网出口路由器上,路由器再和校园外的另一台路由器连接。现要做适当配置,实现校园网内部主机与校园网外部主机之间的相互通信。为了简化网管的管理维护工作,学校决定采用 RIP V2 协议实现互通。三、技术原理RIP(Routing Information Protocols) ,路由信息协议,是应用较早、使用较普通的 IGP内部网关协议,适用于小型同类网络,是距离矢量协议;RIP 协议以跳数衡量路径开销,RIP 协议里规定最大跳数为 15;RIP 协议有两个版本:R
25、IPv1 和 RIPv2,RIPv1 属于有类路由协议,不支持 VLSM,以广播形式进行路由信息的更新,更新周期为 30 秒;RIPv2 属于无类路由协议,支持VLSM,以组播形式进行路由更新。四、实验过程1、实验拓扑1、在三层交换机上划分 VLAN10 和 VLAN20,其中 VLAN10 用于连接校园网主机,VLAN20 用于连接 R1;2、路由器之间通过 V.35 电缆通过串口连接, DCE 端连接在 R1 上,配置其时间频率为64000;3、主机和交换机通过直连线连接,主机与路由器通过交叉线连接;4、在 S3560 上配置 RIPv2 路由协议;5、在路由器 R1、R2 上配置 RIP
26、v2 路由协议;6、将 PC1、PC2 主机默认网关分别设置为与直连网络设备接口 IP 地址;7、验证 PC1、PC2 主机之间可以互相通信;2、配置过程 配置三层交换机 S3560:SwitchSwitchenSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#hostname S3560S3560(config)#vlan 10S3560(config-vlan)#exitS3560(config)#vlan 20S3560(config-vlan)#exitS356
27、0(config)#interface fa0/10S3560(config-if)#switchport access vlan 10S3560(config-if)#exitS3560(config)#interface fa0/20S3560(config-if)#switchport access vlan 20S3560(config-if)#exitS3560(config)#interface vlan 10%LINK-5-CHANGED: Interface Vlan10, changed state to up%LINEPROTO-5-UPDOWN: Line protoco
28、l on Interface Vlan10, changed state to upS3560(config-if)#ip address 192.168.1.1 255.255.255.0S3560(config-if)#exitS3560(config)#interface vlan 20%LINK-5-CHANGED: Interface Vlan20, changed state to upS3560(config-if)#ip address 192.168.3.1 255.255.255.0 /交换机设管理 IP 及掩码S3560(config-if)#exitS3560(conf
29、ig)#router rip /三层交换机设动态路由协议 RIPS3560(config-router)#network 192.168.1.0 /分配的网段S3560(config-router)#network 192.168.3.0 /分配的网段S3560(config-router)#version 2 /rip version 2 支持无分类路由协议S3560(config-router)#%LINK-5-CHANGED: Interface FastEthernet0/20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol
30、 on Interface FastEthernet0/20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to upS3560(config-router)#endS3560#%SYS-5-CONFIG_I: Configured from console by consoleS3560#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD
31、 - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static r
32、oute, o - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Vlan10C 192.168.3.0/24 is directly connected, Vlan20S3560#show ip route /当配置好所有 RIPv2 后,再查看路由信息Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP,
33、EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 -
34、ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Vlan10R 192.168.2.0/24 120/2 via 192.168.3.2, 00:00:01, Vlan20C 192.168.3.0/24 is directly connected, Vlan20R 192.168.4.0/24 120/1 via 192.168.3.2, 00:00:01, Vlan20S3560# 路由器 R1 配置:Routere
35、nRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R1R1(config)#interface fa0/0R1(config-if)#no shutdown %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR
36、1(config-if)#ip address 192.168.3.2 255.255.255.0R1(config-if)#exitR1(config)#interface serial 2/0R1(config-if)#no shutdown %LINK-5-CHANGED: Interface Serial2/0, changed state to downR1(config-if)#clock rate 64000R1(config-if)#ip address 192.168.4.1 255.255.255.0R1(config-if)#exitR1(config)#router r
37、ipR1(config-router)#network 192.168.3.0R1(config-router)#network 192.168.4.0R1(config-router)#version 2R1(config-router)#end%SYS-5-CONFIG_I: Configured from console by consoleR1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O -
38、OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downloade
39、d static routeGateway of last resort is not setR 192.168.1.0/24 120/1 via 192.168.3.1, 00:00:15, FastEthernet0/0C 192.168.3.0/24 is directly connected, FastEthernet0/0R1#%LINK-5-CHANGED: Interface Serial2/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state
40、to upR1#show ip route /当配置好所有 RIPv2 后,再查看路由信息 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E -
41、EGPi - 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 - ODRP - periodic downloaded static routeGateway of last resort is not setR 192.168.1.0/24 120/1 via 192.168.3.1, 00:00:19, FastEthernet0/0R 192.168.2.0/24 120/1 via 192.168
42、.4.2, 00:00:11, Serial2/0C 192.168.3.0/24 is directly connected, FastEthernet0/0C 192.168.4.0/24 is directly connected, Serial2/0R1# 路由器 R2 配置:RouterenRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R2R2(config)#interface fa0/0R2(config-if)#no shutdow
43、n %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR2(config-if)#ip address 192.168.2.1 255.255.255.0R2(config-if)#exitR2(config)#interface serial 2/0R2(config-if)#no shutdown %LINK-5-CHANGED: Interface
44、 Serial2/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to upR2(config-if)#ip address 192.168.4.2 255.255.255.0R2(config-if)#exitR2(config)#end%SYS-5-CONFIG_I: Configured from console by consoleR2#show ip routeCodes: C - connected, S - static, I - IGRP
45、, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate
46、 default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setC 192.168.2.0/24 is directly connected, FastEthernet0/0C 192.168.4.0/24 is directly connected, Serial2/0R2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#rou
47、ter ripR2(config-router)#network 192.168.2.0R2(config-router)#network 192.168.4.0R2(config-router)#version 2R2(config-router)#end%SYS-5-CONFIG_I: Configured from console by consoleR2#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external,
48、O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - 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 - ODRP - periodic downl
49、oaded static routeGateway of last resort is not setR 192.168.1.0/24 120/2 via 192.168.4.1, 00:00:00, Serial2/0C 192.168.2.0/24 is directly connected, FastEthernet0/0R 192.168.3.0/24 120/1 via 192.168.4.1, 00:00:00, Serial2/0C 192.168.4.0/24 is directly connected, Serial2/0R2#3、连通性测试Packet Tracer PC Command Line 1.0PCipconfigIP Address: 192.168.2.2Su