©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-1配置动态路由协议OSPF©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-2什么是OSPF?•快速收敛•支持VLSM•没有跳数限制•路由刷新过程更有效•以带宽衡量路径的好坏©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-3OSPF术语Area1LinksTokenRingCost=10Cost=1785Cost=6DRBDRArea0AdjacenciesDatabaseListsNeighborsRoutingTableListsBestRoutesLink-stateDatabaseListsAllRoutes©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-4Neighborship:TheHelloPacket©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-5EstablishingBidirectionalCommunication©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-6利用Hellos包选择DR和BDR所有路由器与DR和BDR建立邻接关系SelectDRandBDRDRBDR©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-7DiscoveringtheNetworkRoutes©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-8AddingtheLink-StateEntries©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-9SPFCalculationAssumealllinksareEthernet,withanOSPFcostof10.©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-10选择路由RoutingTableNetCostOutInterface2.2.2.06TR03.3.3.07TR03.3.3.010E0TokenRingCost=10Cost=6FDDICost=1ABC这是到3.3.3.0最好的路由.1.1.1.0/242.2.2.0/243.3.3.0/244.4.4.0/24©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-11•RouterAnotifiesallOSPFDRson224.0.0.6.•DRnotifiesotherson224.0.0.5.MaintainingRoutingInformation©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-12Link-StateDataStructures:LSAOperation©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-13OSPFPacketTypes©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-14routerospfprocess-id[vrfvpn-name]Router(config)#•EnablesoneormoreOSPFroutingprocessesConfiguringBasicOSPFnetworkip-addresswildcard-maskareaarea-idRouter(config-router)#•DefinestheinterfacesthatOSPFwillrunonRouter(config-if)#ipospfprocess-idareaarea-id[secondariesnone]•OptionalmethodtoenableOSPFexplicitlyonaninterface©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-15ConfiguringOSPFonInternalRoutersofaSingleArea©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-16RouterID:•在OSPF中标识一个路由器•缺省为所有活跃端口的最大IP地址•如配置了loopback端口,则使用它的地址RealLoopbackAddressEx:131.108.17.5?InOSPFtable?Usesaddressspace?CanusepingBogusLoopbackAddressEx:1.1.1.1?NotinOSPFtable?Savesaddressspace?CannotusepingNetwork131.108.0.0可选配置命令©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-17为一个数据流出的端口配置管辖距离值其它端口需做相应的配置Cisco路由器间默认使用缺省值CiscoNon-CiscoTrafficTokenRingRouter(config-if)#ipospfcostcost可选配置命令(续)©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-18Router#showipospfinterface检验OSPF操作•显示areaID和邻接信息Router#showipprotocol•检查OSPF的配置情况Router#showiproute•显示所有学到的路由©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-19•显示路由器定时器•显示DR/BDR和邻居信息•显示链路状态数据库检验OSPF操作(续)Router#showipospfneighbordetailRouter#showipospfdatabaseRouter#showipospf©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-20检验OSPF操作(续)•清除路由表Router#cleariproute*Router#debugipospf•显示路由器相关过程(如:hello,exchange,flooding)的所有信息©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-21创建多个OSPF区域©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-22大型OSPF网络的维护问题OSPFOSPFOSPFOSPFOSPF我的路由表太大了,内存不够SPF运行太频繁了我收到的都是LSA信息©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-23区域0区域1区域2自治域整个结构由区域和自治域组成减少了路由更新流量解决方案:OSPF层次化路由©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-24多区域OSPF的组成部分区域0骨干区域区域2stub区域区域1标准区域区域路由器LSAs内部ABRASBR骨干Type1afadjfjorqpoeru39547439070713Type2afadjfjorqpoeru39547439070713Type3/4afadjfjorqpoeru39547439070713Type5afadjfjorqpoeru39547439070713©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-25OSPF路由器的类型内部路由器区域1区域2ASBR和骨干路由器骨干/内部路由器ABR和骨干路由器骨干区域0外部自治域ABR和骨干路由器内部路由器©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-26计算汇总路由和自治域外部路由的开销区域1区域01010R1R5R4R3的开销:AS1(E1)viaR1=1795AS1(E1)viaR3=17851017851785自治域1R3R5的开销:AS1(E1)viaR1=1815AS1(E1)viaR3=1805E1E1©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-27区域的类型Stub区域TotallyStubby区域骨干区域0不接受外部LSA连接各个区域;接受所有的LSA不接受外部LSA或汇总LSA©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-28配置OSPFABRE010.64.0.110.64.0.2E0S010.2.1.210.2.1.1S1ABCABROutputOmittedinterfaceEthernet0ipaddress10.64.0.1255.255.255.0!OutputOmittedrouterospf77network10.64.0.00.0.0.255area0区域1区域0OutputOmittedinterfaceEthernet0ipaddress10.64.0.2255.255.255.0!interfaceSerial0ipaddress10.2.1.2255.255.255.0OutputOmittedrouterospf50network10.2.1.20.0.0.0area1network10.64.0.20.0.0.0area0©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-29最小化路由表中项目的数目将拓扑结构改变的影响本地化使用路由汇总区域0骨干ABRs区域1汇总xx©2004,CiscoSystems,Inc.Allrightsreserved.CCNA640-801v4.0—10-30检验OSPF工作过程•列出在自治域系统中的ABR•显示虚拟链路的状态•显示路由器所连接的每个区域的统计内容•显示OSPF拓扑表格showipospfprocess-idRouter#showipospfvirtual-linksRouter#showipospfdatabaseRouter#showipospfborder-routersRouter#