动态路由配置实验报告

实验九 动态路由配置

一、实验目的

1. 掌握RIP协议的相关配置

2. 掌握OSPF协议的相关配置

二、相关知识及原理

1、RIP协议相关知识

RIP属于距离矢量路由协议,使用跳数作为路径选择的参数,并规定以目标网络的最大跳数为15,如果超过此跳数,则直接丢弃数据包;RIP路由协议每30秒更新一次,并在相邻路由器上进行路由信息广播。

RIP为路由消息协议,存在两个版本V1、V2。RIP V2是V1的改进版本,RIP v2支持VLSM,并提供认证、使用组播地址224.0.0.9传递路由信息

相关配置命令:

Router(config)#router rip //进入路由配置模式

Router(config-router)#version 1/2 //指定RIP的版本为1或2

Router(config-router)#network M1 //指定本地端口连接的网络ID,M1为网络ID

2、OSPF协议相关知识

OSPF是一种典型的链路状态路由协议。采用OSPF的路由器彼此交换并保存整个网络的链路信息,从而掌握全网的拓扑结构,独立计算路由。

OSPF作为一种内部网关协议(Interior Gateway Protocol,IGP),用于在同一个自治域(AS)中的路由器之间发布路由信息。区别于距离矢量协议(RIP),OSPF具有支持大型 网络、路由收敛快、占用网络资源少等优点,在目前应用的路由协议中占有相当重要的 地位。

OSPF协议引入“分层路由”的概念,将网络分割成一个“主干”连接的一组相互独立的部分,这些相互独立的部分被称为“区域” (Area),“主干”的部分称为“主干区域(area 0)”。每个区域就如同一个独立的网络,该区域的OSPF路由器只保存该区域的链路状态。每个路由器的链路状态数据库都可以保持合理的大小,路由计算的时间、报文数量都不会过大。 在多于一个区域的自治系统中,OSPF 规定必须有一个骨干区(backbone)-area 0,骨干区是 OSPF的中枢区域,它与其他区域通过区域边界路由器(ABR)相连。

相关配置命令:

Router(config)#router OSPF process-number

//参数process-number表示路由进程编号,其取值范围是:1~65535

Router(config-router)#network network-address wildcard-mask area area-number

//参数network-address表示IP子网号;wildcard-mask表示通配符掩码,它是子网掩码的反码;area-number区域号,0~4 294 967 295范围内的十进制数,也可以用点分十进制的方法表示。

三、实验内容

1、实验拓扑:

动态路由配置实验报告

2、地址规划如下:

3、路由器上RIP的配置

◆Router1的rip配置情况如下所示:

https://upload.fanwen118.com/wk-img/img100/3565286_1.jpg

◆Router2的rip配置情况如下所示:

https://upload.fanwen118.com/wk-img/img100/3565286_2.jpg

4、路由器上OSPF的配置:

◆Router1的OSPF配置情况如下所示

动态路由配置实验报告

◆Router2的OSPF配置情况如下所示

动态路由配置实验报告

5、 验证PC间通信状况

PC0到PC1的通信,PC0到PC2的通信,PC0到PC3的通信状况如下

动态路由配置实验报告

四、验中遇到的问题及解决方法

在本次试验中运用RIP协议与OSPF协议相关知识对路由器进行配置,这个试验的内容相对比较少也相对比较简单,所以在实验中并未出现太大的问题,通过这次试验了解到了更多的路由器的协议及配置命令。

 

第二篇:路由器OSPF动态路由配置

                                路由器OSPF动态路由配置

实验目标:

掌握OSPF协议的配置方法:

掌握查看通过动态路由协议OSPF学习产生的路由:

熟悉广域网线缆的连接方式:

实验背景

假设某公司通过一台三层交换机连到公司出口路由器上,路由器再和公司外的另一台路由器连接。现要做适当配置,实现公司内部主机与公司外部主机之间的相互通信。为了简化网管的管理维护工作,公司决定采用OSPF协议实现互通。

技术原理:

OSPF开放式最短路径优先协议,是目前网络中应用最广泛的路由协议之一。属于内部网关路由协议,能够适应各种规模的网络环境,是典型的链路状态协议。OSPF路由协议通过向全网扩散本设备的链路状态信息,使网络中每台设备最终同步一个具有全网链路状态的数据库,然后路由器采用SPF算法,以自己为根,计算到达其他网络的最短路径,最终形成全网络路由信息。

实验步骤:

1:新建网络拓扑图,文件夹下面有完整拓扑图。

2:在本实验中的三层交换机上划分VLAN10和VLAN20,其中VLAN10用于连接校园网主机,VLAN20用于连接R1.

3:主机和交换机通过直连线连接,主机与路由器通过交叉线连接。

4:路由器之间通过v.35线缆通过串口连接,DCE端连接在R1上,配置其时钟频率64000.

5:在S3560交换机上配置OSPF路由协议。

6:将PC1,PC2主机默认网关分别设置为与直连网络设备接口IP地址。

7:验证PC1,PC2主机之间可以互相通信:

设置:pc0地址

192.168.1.2

255.255.255.0

192.168.1.1

pc1地址:

192.168.2.2

255.255.255.0

192.168.2.1

对3层交换机进行配置:

Switch>enable

Switch#config terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname s3560

s3560(config)#vlan 10

s3560(config-vlan)#exit

s3560(config)#vlan 20

s3560(config-vlan)#exit

s3560(config)#interface fa0/10

s3560(config-if)#switchport access vlan 10

s3560(config-if)#exit

s3560(config)#interface fa0/20

s3560(config-if)#switchport access vlan 20

s3560(config-if)#exit

s3560(config)#interface vlan 10

%LINK-5-CHANGED: Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

s3560(config-if)#ip address 192.168.1.1 255.255.255.0

s3560(config-if)#no shutdown

s3560(config-if)#exit

s3560(config)#interface vlan 20

%LINK-5-CHANGED: Interface Vlan20, changed state to up

s3560(config-if)#ip address 192.168.3.1 255.255.255.0

s3560(config-if)#no shutdown

s3560(config-if)#end

s3560#

%SYS-5-CONFIG_I: Configured from console by console

s3560#config terminal

Enter configuration commands, one per line.  End with CNTL/Z.

s3560(config)#router ospf 2

s3560(config-router)#network 192.168.1.0 0.0.0.255 area 0

s3560(config-router)#network 192.168.3.0 0.0.0.255 area 0

s3560(config-router)#end

s3560#

%SYS-5-CONFIG_I: Configured from console by console

s3560#show 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 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

C    192.168.1.0/24 is directly connected, Vlan10

s3560#

对路由器0进行配置:

Router>enable

Router#config terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#hostname R0

R0(config)#interface fa0/0

R0(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 up

R0(config-if)#ip address 192.168.3.2 255.255.255.0

R0(config-if)#exit

R0(config)#interface serial 2/0

R0(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to down

R0(config-if)#clock rate 64000

R0(config-if)#ip address 192.168.4.1 255.255.255.0

R0(config-if)#end

R0#

%SYS-5-CONFIG_I: Configured from console by console

R0#show 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 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

C    192.168.3.0/24 is directly connected, FastEthernet0/0

R0#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R0(config)#router ospf 2

R0(config-router)#network 192.168.3.0 0.0.0.255 area 0

R0(config-router)#

00:23:45: %OSPF-5-ADJCHG: Process 2, Nbr 192.168.3.1 on FastEthernet0/0 from LOADING to FULL, Loading Done

R0(config-router)#network 192.168.4.0 0.0.0.255 area 0

R0(config-router)#end

R0#

%SYS-5-CONFIG_I: Configured from console by console

R0#

对路由器R1进行配置:

Router>enable

Router#config terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#hostname R1

R1(config)#interface fa0/0

R1(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 up

R1(config-if)#ip address 192.168.2.1 255.255.255.0

R1(config-if)#exit

R1(config)#interface serial 2/0

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to up

R1(config-if)#ip address 192.168.4.2

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up

R1(config-if)#no shutdown

R1(config-if)#ip address 192.168.4.2 255.255.255.0

R1(config-if)#end

%SYS-5-CONFIG_I: Configured from console by console

R1#show 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 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

C    192.168.2.0/24 is directly connected, FastEthernet0/0

C    192.168.4.0/24 is directly connected, Serial2/0

R1#config terminal

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#router ospf 2

R1(config-router)#network

% Incomplete command.

R1(config-router)#network 192.168.2.0 0.0.0.255 area 0

R1(config-router)#network 192.168.4.0 0.0.0.255 area 0

R1(config-router)#

00:30:32: %OSPF-5-ADJCHG: Process 2, Nbr 192.168.4.1 on Serial2/0 from LOADING to FULL, Loading Done

R1(config-router)#end

R1#

%SYS-5-CONFIG_I: Configured from console by console

R1#show 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 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

O    192.168.1.0/24 [110/783] via 192.168.4.1, 00:00:23, Serial2/0

C    192.168.2.0/24 is directly connected, FastEthernet0/0

O    192.168.3.0/24 [110/782] via 192.168.4.1, 00:00:23, Serial2/0

C    192.168.4.0/24 is directly connected, Serial2/0

R1#

在PC0上进行 ping 192.168.2.2

是可以通信的。

相关推荐