路由协议基础2内容路由协议基本介绍静态路由协议及动态路由协议路由协议分类常用路由协议3概念Internet:inter+network路由器(router):route+er路由协议:routingprotocol4概念地址:10.10.10.10/24路由表:10.10.10.0/24via10.10.9.1AS:Autonomoussystem5Toroute,arouterneedstodothefollowing:•Knowthedestinationaddress•Identifythesourcesitcanlearnfrom•Discoverpossibleroutes•Selectthebestroute•MaintainandverifyroutinginformationWhatIsRouting?6•Routersmustlearndestinationsthatarenotdirectlyconnected.WhatIsRouting?(Cont.)7路由StaticDefaultDynamic(1)信息的传播(2)路由的计算8StaticRoute•UsesaroutethatanetworkadministratorentersintotheroutermanuallyDynamicRoute•UsesaroutethatanetworkroutingprotocoladjustsautomaticallyfortopologyortrafficchangesIdentifyingStaticandDynamicRoutes9StaticRoutes•Configureunidirectionalstaticroutestoandfromastubnetworktoallowcommunicationstooccur.10StaticRouteExample•Thisisaunidirectionalroute.Youmusthavearouteconfiguredintheoppositedirection.11DefaultRoutes•ThisrouteallowsthestubnetworktoreachallknownnetworksbeyondrouterA.12路由协议种类按应用范围分:IGP:InteriorgatewayprotocolEGP:exteriorgatewayprotocol按作用原理分:距离矢量:distancevector链路状态:link-state13•Anautonomoussystemisacollectionofnetworksunderacommonadministrativedomain.•IGPsoperatewithinanautonomoussystem.•EGPsconnectdifferentautonomoussystems.AutonomousSystems:InteriororExteriorRoutingProtocols14AdministrativeDistance:RankingRoutes15距离矢量路由协议初始化时,所有路由器在本机形成与本地直接连接的链路记录路由器向所有相连的路由器广播路由表内已有的记录路由器向外广播接收到的路由信息,再在邻路由器形成记录16相关内容路由更新:定期更新路由计算:hop或复合路由收敛:缺点:收敛慢、路由回环、路由表全部更新优化措施:毒性翻转、水平分割、触发更新增强型距离矢量协议17典型协议RIPIGRPEIGRP18链路状态路由协议当路由器初始化或当网络结构发生变化时,路由器会产生链路状态广播数据包LSA(Link-StateAdvertisement)所有路由器会通过一种被称为刷新(Flooding)的方法来交换链路状态数据。路由协议收敛以后,所有的路由器会根据其各自的链路状态信息数据库计算出各自的路由表。19相关内容SPF算法层次结构Metric20典型协议OSPFIS-IS21Afterinitialflood,passsmallevent-triggeredlink-stateupdatestoallotherroutersLink-StateRoutingProtocols22•Minimizesroutingtableentries•LocalizesimpactofatopologychangewithinanareaLink-StateNetworkHierarchyExample23Link-StateRoutingProtocolAlgorithms24BenefitsofLink-StateRouting•Fastconvergence:changesarereportedimmediatelybythesourceaffected.•Robustnessagainstroutingloops:–Routersknowthetopology.–Link-statepacketsaresequencedandacknowledged.•Bycareful(hierarchical)networkdesign,youcanutilizeresourcesoptimally.25DrawbackstoLink-StateRoutingProtocols•Initialdiscoverymaycauseflooding.•Memory-andprocessor-intensive.26距离矢量VS链路状态距离矢量路由协议:shareinformationlocallyuseadistributedroutecalculation链路状态路由协议:informationdistributedunchanged;eachrouterperformalocalbest-pathcalculation27BGP协议BorderGatewayProtocol广泛应用于目前Internet上路径矢量IBGP,EBGP路由对等体策略28AutonomousSystemsAutonomousSystem65000AutonomousSystem65500IGPs:RIP,IGRP,OSPF,EIGRPEGPs:BGP•Anautonomoussystem(AS)isacollectionofnetworksunderasingletechnicaladministration•IGPsoperatewithinanautonomoussystem•EGPsconnectdifferentautonomoussystems29BGPIsUsedBetweenAutonomousSystems•BGPisusedbetweenautonomoussystems•Guaranteesexchangeofloop-freeroutinginformationBGPBBGPAS65500AS65250BGPAS64520AS65000ABCFED•RoutingTablePrefixes020501104,02730BGPCharacteristicsBGPisadistancevectorprotocolwithenhancements:•Reliableupdates—BGPrunsontopofTCP(port179)•Incremental,triggeredupdatesonly•PeriodickeepalivestoverifyTCPconnectivity•Richmetrics(calledpathvectorsorattributes)•Designedtoscaletohugeinternetworks(forexample,theInternet)31BGPinIPPacketsBGPisanadvanceddistancevectorroutingprotocol•ReliesonTCPforreliablesessionmanagement•UsesTCPportnumber179TCPHeaderPortNo.SegmentPayloadIPHeaderProtocolNumberFrameHeaderCRCPacketPayloadFramePayload6—TCP17—UDP179—BGP23—Telnet25—SMTP32TablesIGPRoutingProtocolBGPRoutingProtocolIPBGP•BGPhasitsowntable,inadditiontotheIProutingtable•Informationcanbeexchangedbetweenthetwotables33•AnytworoutersthathaveformedaTCPconnectioninordertoexchangeBGProutinginformationarecalledpeersorneighborsPeers=NeighborsAS65000NeighborsAS65500NeighborsACB34InternalBGP•WhenBGPneighborsbelongtothesameASitiscalledinternalBGP(IBGP)•NeighborsdonothavetobedirectlyconnectedAIBGPNeighborsAS65000AS65500NeighborsBC35ExternalBGP•WhenBGPneighborsbelongtodifferentautonomoussystemsitiscalledexternalBGP(EBGP)•NeighborsshouldbedirectlyconnectedAAS65000AS65500EBGPNeighborsIBGPNeighborsCB36Policy-BasedRouting•BGPallowsadministratorstodefinepolicies,orrules,forhowdatawillflowthroughtheautonomoussystems37BGPAttributesBGPattributesinclude:•AS-path•Next-hop•Localpreference•Multi-exitdiscriminator(MED)•Origin•Community38BGPdefinesthefollowingmessagetypes:•Open–IncludesholdtimeandBGProuterID•Keepalive•Update–Informationforonepathonly(couldbetomultiplenetworks)–Includespathattributesandnetworks•Notification–Whenerrordetected–BGPconnectionclosedaftersentBGPMessageTypes39RouteSelectionDecisionProcessConsideronly(synchronized)routeswithnoASloopsandavalidnexthop,andthen:•Preferhighestweight(localtorouter)•Preferhighestlocalpreference(globalwithinAS)•Preferrouteoriginatedbythelocalrouter•PrefershortestAS-path•Preferlowestorigincode(IGPEGPincomplete)•PreferlowestMED(fromotherAS)•PreferEBGPpathoverIBGPpath•PreferthepaththroughtheclosestIGPneighbor•Preferold