您的位置:首页 > 理论基础 > 计算机网络

路由协议总结

2011-09-16 13:51 211 查看
路由基础知识
静态路由
静态路由是指由管理员手工配置成的路由信息。当网络的拓扑结构或链路的状态发生变化时,网络管理员需要手工去修改路由表中相关的静态路由信息。静态路由信息在缺省情况下是私有的,不会传递给其他的路由器。当然,管理员也可以通过对路由器进行设置使之成为共享的。静态路由一般适用于比较简单的网络环境,在这样的环境中,网络管理员易于清楚地了解网络拓扑结构,便于设置正确的路由信息。
动态路由
动态路由是网络中的路由器之间相互通信,传递路由信息,利用收到的路由信息更新路由器表的过程。它能实时地适应网络结构的变化。如果路由更新信息表明发生了网络变化,路由选择软件就会重新计算出路由,并发出新的路由更新信息。这些信息通过各个网络,引起各路由器重新启动其路由算法,并更新各自的路由表以动态地反映网络拓扑变化。动态路由适用于网络规模大、网络拓扑复杂的网络。当然,各种动态路由协议会不同程度地占用网络带宽和CPU资源。
可路由协议(Routed Protocol)=被路由协议
利用网络层完成的协议,允许数据包从一个主机依靠一寻址方案转发到另一主机。例如:IP;IPX;AppleTalk
路由协议(Routeing Protocol)=路由选择协议
本质是创建和维护路由表,,可路由协议利用他实现路由功能。例如:RIP;IGRP;EIGRP;OSPF;BGP;IS-IS等;
路由协议的度量值
RIP:用跳数来衡量网络路由选择,最大15跳(距离矢量协议)
IGRP:由四个要素组成:时延(Delay)、带宽(Bandwidth,简称BW)、负载(Load)和可靠性(Reliability)
计算公式:Metric=[k1*BW(IGRP)+k2*BW(IGRP)/(256-Load)+k3*DLY(IGRP)]*[k5/(RELY+k4)]
其中BW是取到目标地址所经出口的最小,DLY(IGRP)是沿途的DLY(IGRP)的总和。
K1,k2,k3,k4和k5是可配置的加权(weight)值,默认这些值是k1=k3=1,k2=k4=k5=0
EIGRP:EIGRP metric = IGRP metric x256
OSPF:通过接口带宽来确定开销(cost)
100Mbps/ 带宽是默认计算公式
IS-IS:所有接口开销默认为10
10.2、管理距离
管理距离是指一种路由协议可信度。每一种路由协议按可靠性从高到低,依次分配一个信任等级,这个信任等级就叫管理距离。对于两种不同的路由协议到一个目的地的路由信息,路由器首先根据管理距离决定相信哪一个协议。
Route Source 路由源
Default Distance 默认距离值
Connected interface 直连接口
0
Static Route 静态路由
1
EIGRP Summary Route EIGRP 汇总路由
5
Extermal BGP 外部BGP
20
Intermal EIGRP 内部EIGRP
90
IGRP
100
OSPF
110
IS-IS 中间系统到中间系统
115
RIPV1,RIPV2
120
EGP 外部网管协议
140
Extermal EIGRP 外部EIGRP
170
Intermal BGP 内部BGP
200
未知Unknown
255
10.3、路由重发布
简单的路由选择协对于简单的网络来说是可以很好的工作,随着网络越来越复杂,可能需要更换路由协议。通常网络协议的过渡是逐步进行的,在一段时间内,网络中同时存在多种路由选择协议。
路由器在重发布的时候,必须给重分发的路由指定度量值。这种度量值被称为种子度量值或者默认度量值。
RIP/IGRP/EIGRP默认度量值为0,就是说向这几种协议的网络中通告路由,需要手工指定种子度量值,否则重分发的路由不会被通告。
OSPF中,重分发而来的路由默认为2类(E2),度量值为20,BGP向OSPF重新发布路由的种子度量值为1
IS-IS中,重发布而来的路由默认度量值为0,值得注意的是,该路由是可达的。可以给IS-IS路由协议配置种子度量值。
BGP中,重分发而来的路由保留其IGP路由选择度量值。
Protocol
Default Seed Metric
RIP
Infinity
IGRP/EIGRP
Infinity
OSPF
20 for all except BGP,which is 1
IS-IS
0
BGP
BGP metric is set to IGP metric value
重分发技术有两种方法:双向重分发、单向重分发
双向重分发:在两个路由选择进程之间重分发所有路由。
单向重分发:将一条默认路由传递给一种路由选择协议,同时只将该路由选择协议获悉的网络传递给其他路由选择协议。单向重分发最安全,但是有可能会导致网络中的单点故障。如果必须在两个方向上或者多台边界路由上执行重分发,应该调整重分发以避免次优路由选择和路由选择环路等问题。根据网络设计的不同,可以使用下列重分发技术。
重发布原则:
1、 当重新分配路由时,必须为路由配置一个接收协议可以理解的度量值。
2、 在多种路由协议之间,需要为路由源分配管理距离;可把管理距离看做可信度的一个量值,管理距离越小,协议的可信度越高。
3、 在从无类别路由选择协议向有类别路由选择协议重新分配时也会使用到,仅在掩码相同的接口之间通告路由这一特性。



代码配置:
RA:
enable
conf t
no ip domain lookup
hostname RA
int s1/1
ip address 192.168.10.1 255.255.255.0
no shut
exit
int lo1
ip address 100.100.100.2 255.0.0.0
no shutdown
exit
int lo2
ip address 10.10.10.100 255.0.0.0
no shutdown
router ospf 100
network 192.168.10.0 0.0.0.255 area 0
network 100.100.100.0 0.255.255.255 area 0
network 10.10.10.0 0.255.255.255 area 0
end
RB:
enable
conf t
no ip domain lookup
hostname RB
int s1/0
ip address 192.168.10.2 255.255.255.0
clock rate 56000
no shut
exit
int s1/1
ip address 192.168.11.1 255.255.255.0
clock rate 56000
no shut
exit
router ospf 100
network 192.168.10.0 0.0.0.255 area 0
network 192.168.11.0 0.0.0.255 area 0
end
在路由器B上配置路由协议重发布:
Redistribute ospf 1 metric 10000 100 255 1 1500
Passive-interface ethernet 1 路由分配了IGRP度量;按顺序,命令中各数字分别表示为:带宽10000kbit/s,时延100;可靠性;负载;MTU
Router ospf 100
Redistribute igrp 1 metric 30 metric-type 1 subnets
Network 192.168.10.0 0.0.0.255 area 0

RC:
enable
conf t
no ip domain lookup
hostname RC
int s1/0
ip address 192.168.11.2 255.255.255.0
no shut
exit
router igrp 1
end



RA:
enable
conf t
no ip domain lookup
hostname RA
int s1/1
ip address 192.168.10.1 255.255.255.0
no shut
exit
int lo1
ip address 100.100.100.2 255.0.0.0
no shutdown
exit
int lo2
ip address 10.10.10.100 255.0.0.0
no shutdown
router rip
network 100.100.100.0
network 10.10.10.0
end
RB:
enable
conf t
no ip domain lookup
hostname RB
int s1/0
ip address 192.168.10.2 255.255.255.0
clock rate 56000
no shut
exit
int s1/1
ip address 192.168.11.1 255.255.255.0
clock rate 56000
no shut
exit
router rip
network 192.168.10.0
network 192.168.11.0
end
在路由器B上做路由再发布:
Router rip
Redistribute igrp 1 metric 5
Passive-interface s1/0
Network 192.168.11.0
Router igrp
Redistribute rip
Default-metric 1000 100 255 1 1500
Network 192.168.10.0
RC:
enable
conf t
no ip domain lookup
hostname RC
int s1/0
ip address 192.168.11.2 255.255.255.0
no shut
exit
int lo1
ip address 20.20.20.2 255.0.0.0
no shutdown
exit
int lo2
ip address 200.200.200.2 255.255.255.0
no shutdown
exit
router igrp 1
end



RA:
enable
conf t
no ip domain lookup
hostname RA
int s1/1
ip address 192.168.10.1 255.255.255.0
no shut
exit
int lo1
ip address 100.100.100.2 255.0.0.0
no shutdown
exit
int lo2
ip address 10.10.10.100 255.0.0.0
no shutdown
router isis
end
RB:
enable
conf t
no ip domain lookup
hostname RB
int s1/0
ip address 192.168.10.2 255.255.255.0
clock rate 56000
no shut
exit
int s1/1
ip address 192.168.11.1 255.255.255.0
clock rate 56000
no shut
exit
router ospf 100
network 192.168.10.0 0.0.0.255 area 0
network 192.168.11.0 0.0.0.255 area 0
end
在路由器B上做路由再发布:
Router IS-IS
Redistribute rip metric 0 metric-type internal level-2
Network 01. 0001. 0000. 0001. 00
Router rip
Redistribute IS-IS level-1-2 metric 1
Passive-interface ethernet 0
Network 192.168.11.0
RC:
enable
conf t
no ip domain lookup
hostname RC
int s1/0
ip address 192.168.11.2 255.255.255.0
no shut
exit
int lo1
ip address 20.20.20.2 255.0.0.0
no shutdown
exit
int lo2
ip address 200.200.200.2 255.255.255.0
no shutdown
exit
router igrp 1
end
RIP和EIGRP路由协议再发布:



R1:
Enable
Config t
No ip domain lookup
Hostname R1
int s0/0
ip add 192.168.1.1 255.255.255.0
clock rate 56000
no shut
exit
router rip
network 192.168.1.0
R2:
Enable
Config t
No ip domain lookup
Hostname R2
int s0/1
ip add 192.168.1.2 255.255.255.0
no shut
int s0/0
ip add 192.168.2.1 255.255.255.0
clock rate 56000
no shut
exit
router rip
network 192.168.1.0
network 192.168.2.0
R3:
Enable
Config t
No ip domain lookup
Hostname R3
int s0/1
ip add 192.168.2.2 255.255.255.0
no shut
exit
router rip
network 192.168.2.0
int s0/0
ip add 192.168.3.1 255.255.255.0
clock rate 56000
no shut
exit
router eigrp 100
network 192.168.3.0
路由协议再发布 (在R3路由器上)
RIP->EIGRP
router eigrp 100
redistribute rip metric 1544 100 255 10 1500
RIPEIRI->PGRP
router rip
redistribute eigrp 100 metric 12
R4:
Enable
Config t
No ip domain lookup
int s0/1
ip add 192.168.3.2 255.255.255.0
no shut
exit
int lo41
ip add 192.168.41.1 255.255.255.0
no shutdown
exit
router Eigrp 100
network 192.168.3.0
network 192.168.41.0
RIP和OSPF路由再发布:



RA:
Router>enable
Router#conf t
Router(config)#no ip domain lookup
Router(config)#hostname RA
RA(config)#int s1/1
RA(config-if)#ip address 192.168.10.1 255.255.255.0
RA(config-if)#no shut
RA(config-if)#exit
RA(config)#int s1/2
RA(config-if)#ip address 152.1.1.2 255.255.0.0
RA(config-if)#no shut
RA(config-if)#exit
RA(config)#router ospf 64
RA(config-router)#network 192.168.10.0 0.0.0.255 area 0
RA(config-router)#network 152.1.1.0 0.0.255.255 area 1
RA(config-router)#end
RA#write
Building configuration...
[OK]
RA#
RB:
Router>enable
Router#conf t
Router(config)#hostname RB
RB(config)#no ip domain lookup
RB(config)#int s1/0
RB(config-if)#ip addre
RB(config-if)#ip address 192.168.10.2 255.255.255.0
RB(config-if)#clock rate 56000
RB(config-if)#no shut
RB(config-if)#exit
RB(config)#int s1/1
RB(config-if)#ip address 152.1.2.1 255.255.0.0
RB(config-if)#clock rate 56000
RB(config-if)#no shut
RB(config)#router rip
RB(config-router)#network 152.1.2.0
RB(config-router)#network 20.152.100.0
RB(config-router)#exit
RB(config)#router ospf 64
RB(config-router)#network 192.168.10.0 0.0.0.255 area 0
RB(config-router)#exit
RB(config)#end
RB#
在路由器B上做双向重发布:
Router ospf 64
Redistribute rip
Default-metric 64
Router rip
Redistribute ospf 64
Default-metric 2
RC:
Router>enable
Router#conf t
Router(config)#no ip domain lookup
Router(config)#hostname RC
RC(config)#int s1/0
RC(config-if)#ip address 152.1.2.2 255.255.0.0
RC(config-if)#no shut
RC(config-if)#exit
RC(config)#int lo1
RC(config-if)#ip address 20.152.100.1 255.0.0.0
RC(config-if)#no shut
RC(config-if)#exit
RC(config)#router rip
RC(config-router)#network 152.1.2.0
RC(config-router)#network 20.152.100.0
RC(config-router)#end
RC#write
Building configuration...
[OK]
RC#
RD:
Router>enable
Router#conf t
Router(config)#no ip domain lookup
Router(config)#hostname RD
RD(config)#int s1/3
RD(config-if)#ip address 152.1.1.1 255.255.0.0
RD(config-if)#clock rate 56000
RD(config-if)#no shut
RD(config-if)#exit
RD(config)#int lo1
RD(config-if)#ip address 10.152.100.1 255.0.0.0
RD(config)#int lo2
RD(config-if)#ip address 20.152.10.1 255.0.0.0
RD(config)#router ospf 64
RD(config-router)#network 152.1.1.0 0.0.255.255 area 1
RD(config-router)#network 10.152.10.0 0.0.0.255 area 1
RD(config-router)#network 20.152.10.0 0.0.0.255 area 1
RD(config-router)#end
RD#write
Building configuration...
[OK]
RD#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息