配色: 字号:
OSPF协议(单区域)
2015-09-06 | 阅:  转:  |  分享 
  
OSPF协议OSPF协议:OSPF,openshortestpathfirst,开放最短路径优先协议,公有标准。(Rid也是公有标准)
分类:IGP,LS,无类。(在NA里面,有类的协议只有RIDV1是又类的,V2是无类)OSPF封装:E2|IP(协议号89)|O
SPF|FCSOSPF概述:通过发送Hello包建立邻居关系10s一个周期发送传播LSA信息发送更新,LinkstateAdv
ertisement,链路状态通告信息链路:路由器接口状态:描述接口以及它与邻居路由器的关系区域概念:LSA泛洪到整个OSPF区域
骨干区域:区域0,area0区域非骨干区域:非0区域,eg:area1,area2,area3路由器角色骨干路由器:属于a
rea0的路由器区域内部路由器:属于某个区域内部的ABR:areaboarderrouter,区域边界路由器,连接多个osp
f区域。Eg:C/D/EASBR:autonomoussystemboarderrouter,自治系统边界路由器,连接多个路
由协议.eg:ExtemalRoutingDomain注意!:OSPF划分区域原则:所有非0区域必须要与区域0相互连接,否则不
能正常通信(花瓣形)链路状态数据库:linkstatedatabase,LSDB,通过LSA交互完成路由表:通过SPF(sho
rtestpathfirst,最短路径优先算法)计算出最优的路径。OSPF衡量一条路由的度量值:开销Cost=(10^8/接口
带宽)OSPF三张表:邻居表:通过发送Hello数据包建立维护邻居关系打星花的跟邻居路由器必须匹配Hello发送周期:每10s发送
一次Dead时间:Deadinterval=hello4倍=40sRouterID:路由标识符,用于唯一地标识OSPF区域当
中的某一台路由器表示方式:使用点分十进制表示(IP地址)选举方式:①手工指定;②自动选举(最大的loopback接口,最大的环回接
口)1.手工指定优先(手工的最优)Router1(config)#routerospf110Router1(config-ro
uter)#router-id1.1.1.1Router1(config-router)#endRouter1#clearip
ospfprocess+yes2.选举最大的loopback接口的IP地址为RID(不是接口ID,而是IP地址)Lo0:10
.1.1.1;Lo10:1.1.1.13.选举最大的物理up接口的IP地址作为RIDNeighbor:建立邻居关系的邻居ID(邻居
的RouterID)AreaID:区域ID,用于标识OSPF的区域使用十进制数:0~42E。0,1,255,256点分十进制表
示:0.0.0.0;0.0.0.1;0.0.0.255;0.0.1.0Routerpriority:路由优先级,用于选举DR,B
DRDRAddress:Designedrouter,指定路由器BDRAddress:BackupdesignedRou
ter,备份指定路由器OSPF在MA(多路访问,Ethernet)网络当中运行,必须要有一个DR,BDRDR与BDR选举Authe
ntication:认证Stub标签:略链路状态数据库路由表R1#showipprotocolsR1#showiprou
teripOSPF配置:R1(config)#router?bgpBorderGatewayProtocol(BGP)
eigrpEnhancedInteriorGatewayRoutingProtocol(EIGRP)ospfOpen
ShortestPathFirst(OSPF)ripRoutingInformationProtocol(RIP)
R1(config)#routerospf?<1-65535>ProcessIDR1(config)#routerosp
f1072R1(config-router)#R1(config-router)#?router-idrouter-idfo
rthisOSPFprocessR1(config-router)#R1(config-router)#router-id
?A.B.C.DOSPFrouter-idinIPaddressformat(点分十的格式)R1(config-ro
uter)#router-idR1#showipprotocolsRoutingProtocolis"ospf107
2"OutgoingupdatefilterlistforallinterfacesisnotsetIncom
ingupdatefilterlistforallinterfacesisnotsetRouterID19
2.168.1.1(默认选出来的,showipintbr查看接口IP)Numberofareasinthisro
uteris0.0normal0stub0nssaMaximumpath:4RoutingforNetwo
rks:RoutingInformationSources:GatewayDistanceLastUpdateDis
tance:(defaultis110)选举路由ID:R1(config)#interfaceloopback0(回环
口,测试使用)R1(config-if)#ipaddress11.1.1.1255.255.255.0R1#clearip
ospfprocess(重置所有OSPF进程)ResetALLOSPFprocesses?[no]:yesR1(c
onfig)#routerospf1072R1(config-router)#router-id1.1.1.1R1(conf
ig-router)#network192.168.1.0?A.B.C.DOSPFwildcardbits(要求输入
:反掩码)把直连网段network出去R1(config-router)#network192.168.1.00.0.0.25
5area0(area0和area1是学习不到的)R1(config-router)#network12.1.1.00.
0.0.255area0R1(config-router)#network14.1.1.00.0.0.255area0
R1(config-router)#exitRIP默认开启自动汇总OSPF默认关闭自动汇总R2(config)#routeros
pf110(邻居之间不要求进程号匹配)R2(config-router)#router-id2.2.2.2R2(config
-router)#network12.1.1.00.0.0.255area0R2(config-router)#netwo
rk23.1.1.00.0.0.255area0R3#showiprouteconnected(查看邻居直连网段
)C23.1.1.0/24isdirectlyconnected,FastEthernet0/0C34.1.1.0/2
4isdirectlyconnected,Serial0/0/1C192.168.2.0/24isdirectly
connected,FastEthernet0/1R3(config)#routerospf110R3(config-rou
ter)#router-id3.3.3.3R3(config-router)#network23.1.1.00.0.0.25
5area0R3(config-router)#network34.1.1.00.0.0.255area0R3(con
fig-router)#network192.168.2.00.0.0.255area0R4(config)#router
ospf110R4(config-router)#router-id4.4.4.4R4(config-router)#net
work14.1.1.00.0.0.255area0R4(config-router)#network34.1.1.0
0.0.0.255area0R1#showipospfneighbor查看OSPF邻居关系NeighborID
PriStateDeadTimeAddressInterface2.2.2.21FULL/BDR00
:00:3012.1.1.2FastEthernet0/04.4.4.40FULL/-00:00:331
4.1.1.4Serial0/0/0Router1(config)#routerospf1072Router1(confi
g-router)#router-id1.1.1.1Router1(config-router)#network192.168
.1.0?A.B.C.DOSPFwildcardbits192.168.1.00.0.0.255192.168.1.1
~192.168.1.255反掩码概念:1代表忽略,0代表匹配192.168.1.0IP:192.168.1.00000000反
掩码:0.0.0.11111111192.168.1.0/30Network192.168.1.00.0.0.325
5.255.255.255255.255.255.252=0.0.0.3192.168.1.0/27192.168.1.0255.
255.255.255255.255.255.2240.0.0.31Router1#showipospfneighbor\\\
查看OSPF邻居关系NeighborID】Pri/State】DeadTime】Address】Interface4.
4.4.40FULL/-00:00:3314.1.1.4Serial0/0/02.2.2.21FULL/BDR0
0:00:3412.1.1.2FastEthernet0/0内容:邻居RouterID邻居优先级:MA网络存在,P2P(se
rial)不存在邻居状态:Full,邻居关系完成Deadtime:40sAddress:邻居与本地建立邻居关系的iP地址Inte
rface:建邻居的接口DR与BDR选举:优先看接口的优先级越大越优先比较RouterID越大越优先R1(config)#int
f0/0R1(config-if)#ipospfpriority2可以修改优先级R1(config-if)#endR1#
showipospfinterfacef0/0#showipprotocol#showipospfneighbor
邻居表#showipospfinterfacef0/0宣告进OSPF的某个接口的详细信息#showipospfdat
abase查看OSPF链路状态数据库#showiprouteospfRouter1#showiprouteospf2
3.0.0.0/24issubnetted,1subnetsO23.1.1.0[110/2]via12.1.1.2
,00:02:43,FastEthernet0/0[AD/Cost]OSPFCost=10^8/接口带宽或(入接口方向累加)
#showipospfinterfacexx、Cost值通过公式进行计算邻居表:邻接拓扑表:LSDB,最全路由表:最优#ro
uterospfxxx(进程号)#router-idx.x.x.x(标识符)#networkx.x.x.xw.w.w.w
areaYY\\network直连网段某个网段反掩码区域ID回顾选举:STP选举OSPFRouterID(手工指
定,最大loopback,最大物理up)OSPFDR、BDR(优先级,RouterID)++++++++++++++++++++
+++++EIGRP:EnhanceinteriorGatewayProtocol,增强型内部网关路由协议发展:RIP,IG
RP(思科私有标准),OSPF,EIGRP(私有标准)收敛速度:RIP:30s,OSPF:几秒;EIGRP:毫秒级别分类:IGP,
高级DV,无类封装:E2|IP(89)|OSPF|FCSE2|IP(88)|EIGRP|FCS特点:(略)PPTEIGRP三张表:
邻居表:存放邻居关系信息拓扑表:存放所有的路由条目以及拓扑信息路由表:最优拓扑表概念:FD:Fesiabledistance,可
行距离,本路由器去往目的网络的距离AD:advertisedistance,通告距离,邻居通告给本路由器,邻居去往目的网络的距离
。Successor:继承者,最优路径FesiableSuccessor:可行继承者,次优路径只有基于TCP才是可靠的。EIG
RP报文类型:Hello报文:5s,用于建立维护邻居关系Update报文:发送路由更新信息Query报文:请求发送路由更新Repl
y报文:回应Query报文,发送响应Ack:对Update、Query、Reply进行确认。EIGRP度量值:BW(最小)、Del
ay(sum)、overload(max),可靠(min),MTU(1500)EIGRP权重值:K1~K5:K1:1,K2:0,K
3:1,K4:0,K5:0Metric=256(10^7/最小带宽+延迟总和/10)EIGRP配置:Router1(config
)#routereigrp?、、、配置EIGRP进程<1-65535>Autonomoussystemnumber、、、
AS,自制系统号Router1(config-router)#network1.1.1.0Router1(config-rout
er)#network10.1.1.00.0.0.255Router1(config-router)#network12.1
.1.00.0.0.255Router1(config-router)#network14.1.1.00.0.0.255Ro
uter1(config-router)#network192.168.1.00.0.0.255Router1(config-
router)#noauto-summaryRouter1(config-router)#exit邻居表:Router1#sho
wipeigrpneighborsIP-EIGRPneighborsforprocess90HAddressIn
terfaceHoldUptimeSRTTRTOQSeq(sec)(ms)CntNum012.1.1.2Fa0
/01200:00:58401000021114.1.1.4Se0/0/01400:00:18401000
028Router1#showiprouteeigrp1.0.0.0/8isvariablysubnetted,
2subnets,2masksD1.0.0.0/8[90/158720]via12.1.1.2,00:01:56,FastEthernet0/023.0.0.0/24issubnetted,1subnetsD23.1.1.0[90/30720]via12.1.1.2,00:01:56,FastEthernet0/0Metric=256(10^7/最小带宽kbit+延迟总和/10)Metric=256(10^7/100000+(100+100)/10)=256120=30720#showipeigrpneighbor(AS,K值))EIGRPmetricweightK1=1,K2=0,K3=1,K4=0,K5=0#showipeigrptopology#showiprouteeigrpRIP、OSPF、EIGRPRoutereigrp/ospf/ripNetworkx.x.x.x
献花(0)
+1
(本文系weini维尼熊...首藏)