文档库 最新最全的文档下载
当前位置:文档库 › 路由协议与配置过程

路由协议与配置过程

路由协议与配置过程

路由选择协议是路由器之间进行信息交流的语言,通过信息的交流建立网络的完整拓扑结构,从而选择最优路径,并将该路径记录到路由表中。一旦路由表建立,路由器便可以通过其输入接口接收数据包,确定其目的地址,然后根据路由表中的信息,将该数据包转送到相应的输出接口。

8.1 IP路由

。动态路由

由路由器通过运行路由协议而生成的到达目标网络的路径。

。静态路由

如果到达目标网络只有一条路径或我们只希望发送的数据包以同一路径传输时,就直接设置路由器的相应接口来指定一条到达目的地址的特定路径。这就是静态路由。静态路由的计量值为0或1,计量值越小则可靠性越高。可以通过提高计量值的方法将静态路由作为备份路由或浮动静态路由。

。缺省路由

当数据包到达路由器时,路由器根据数据包的目标地址到路由表中查找最佳路由。如果没有该路由信息,则使用缺省路由转发,当无缺省路由时则丢弃该数据包。所以,缺省路由就是用户设置的当不知道数据包该往何处发送时,一律发送到一个特定接口的路由。

8.1.1实验静态路由和缺省路由

图8.1

实验配置如图:

cisco2610 配置如下:

Current configuration:

!

version 11.3

hostname 2610

!

enable password cisco

!

interface Ethernet0/0

ip address 202.207.126.253 255.255.255.224

!

interface Serial0/0

ip address 202.207.128.2 255.255.255.0

encapsulation frame-relay

no ip mroute-cache

frame-relay lmi-type ansi

!

ip classless

!

line con 0

line vty 0 4

password cisco

login

!

end

cisco3640 配置如下:

Current configuration:

!

version 12.0

!

hostname 3640

!

frame-relay switching

interface Serial0/0

ip address 202.207.128.1 255.255.255.0

no ip directed-broadcast

encapsulation frame-relay

no ip mroute-cache

no fair-queue

clockrate 38400

frame-relay lmi-type ansi

frame-relay intf-type dce

frame-relay map ip 202.207.128.2 100

!

ip classless

!

line aux 0

line vty 0 4

login

!

end

一)在cisco3640 上增加静态路由:

3640#config terminal

3640(config)#ip route 202.207.126.224 255.255.255.224 202.207.128.2 3640#sh ip route

C 202.207.128.0/24 is directly connected, Serial0/0

202.207.126.0/24 is variably subnetted, 1 subnets, 1 masks

S 202.207.126.224/27 [1/0] via 202.207.128.2

用ping 测试cisco3640到cisco2610 E0/0 接口的连通性:

router3640#ping 202.207.126.253

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 202.207.126.253, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 44/47/48 ms 二)删除静态路由

3640#config terminal

3640(config)#no iproute 202.207.126.224 255.255.255.224 202.207.128.2

8.2 动态路由协议

在网络中要想获得网间的连接性能,必须在所有路由器上都同时设置路由,而随着网络结构及数量的变化,增添和删除路由将是一项复杂而极易出错的管理工作。而用“动态路由”则所有路由器均可共享各自探测到的信息。

通过在网络路由器中对某种路由协议进行配置,然后在适当的接口启动路由协议,则网络中的路由信息将随着网络的变化而自动修改---形成“动态路由”。

8.2.1 RIP 协议

路由信息协议(RIP:routing information protocol)是用于网关(路由器)和主机间交换路由信息的距离向量协议。RIP是一种被广泛应用于同构网络的内部网关协议。TCP/IP最早用RIP提供局域网的路由信息,后来被广泛地用于广域网。

RIP 用跳计数来作为网络距离的计量。当网络拓朴结构发生变化或当路由器经过定时间隔时,每个路由器给相邻路由器发出路由信息---本路由器可到达的网络路由表。当路由器接到路由选择更新信息时,对它的路由表进行路由更新,以反应网络最新的路由信息。RIP路由器仅维持到达目的地址的最佳路由,修改后的路由器立即传送路由更新信息,以通知网络中的其它路由器。路由信息由两部分组成:可到达的网络和到达网络的距离。

距离向量协议都有一个问题,路由器不能知道网络的全局状况,路由器必须由相邻的路由器来获得网络的可达信息。由于路由选择更新在网络中传播慢(例:RIP协议每30秒用UTP520端口给与之相连的设备广播路由更新信息),导致网络上的不一致,引起产生路由选择环路的可能。为了适应网络拓朴结构的快速变化,RIP协议使用跳计数无穷、水平分割、破坏逆转更新、保持计数和触发更新的机制来减少不一致带来的路由选择环路的可能性。

配置IP RIP

在路由器上配置IP RIP 由两步完成:

。启动RIP 进程

。指定接收和发送RIP 更新的接口。

如下图网络中的配置演示RIP 的简单配置过程

路由器配置如下:

1.cisco 3640

Current configuration:

!

version 12.0

!

hostname Router3640

!

frame-relay switching

interface Serial0/0

ip address 202.207.128.1 255.255.255.0

no ip directed-broadcast

encapsulation frame-relay

no ip mroute-cache

no fair-queue

clockrate 38400

frame-relay map ip 202.207.128.2 100

frame-relay lmi-type ansi

frame-relay intf-type dce

!

router rip

network 202.207.128.0

!

line aux 0

line vty 0 4

login

!

end

2.Cisco2610

Current configuration:

!

version 11.3

hostname Router2610

!

enable password cisco

!

interface Ethernet0/0

ip address 202.207.126.253 255.255.255.224 !

interface Serial0/0

ip address 202.207.128.2 255.255.255.0 encapsulation frame-relay

no ip mroute-cache

frame-relay lmi-type ansi

!

router rip

network 202.207.126.0

network 202.207.128.0

!

line con 0

line aux 0

password cisco

login

!

end

配置结果监测

RIP协议的配置和检验较简单。用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, * - candidate default

U - per-user static route, o - ODR

Gateway of last resort is not set

C 202.207.128.0/24 is directly connected, Serial0/0

1R 202.207.126.0/24 [120/1] via 202.207.128.2, 00:00:08, Serial0/0

用debug ip rip on 监视传输的路由更新信息。用clear ip route * 删除ip 路由,则可以看到路由器发出请求报文,另一台路由器则发来路由更新信息。

Router3640#clear ip route *

04:27:48: RIP: sending general request on Serial0/0 to 255.255.255.255

04:27:48: RIP: received v1 update from 202.207.128.2 on Serial0/0

04:27:48: 202.207.128.0 in 1 hops

04:27:48: 202.207.126.0 in 1 hops

04:27:48: RIP: sending v1 update to 255.255.255.255 via Serial0/0 (202.207.128.1)

04:27:48: network 202.207.128.0, metric 1

相关文档