IPC-293CiscoIOSIPConfigurationGuideConfiguringBGPThischapterdescribeshowtoconfigureBorderGatewayProtocol(BGP).ForacompletedescriptionoftheBGPcommandsinthischapter,refertothe“BGPCommands”chapteroftheCiscoIOSIPCommandReference,Volume2of3:RoutingProtocols.Tolocatedocumentationofothercommandsthatappearinthischapter,usethecommandreferencemasterindex,orsearchonline.FormultiprotocolBGPconfigurationinformationandexamples,refertothe“ConfiguringMultiprotocolBGPExtensionsforIPMulticast”chapteroftheCiscoIOSIPConfigurationGuide.FormultiprotocolBGPcommanddescriptions,refertothe“MultiprotocolBGPExtensionsforIPMulticastCommands”chapteroftheCiscoIOSIPCommandReference.BGP,asdefinedinRFCs1163and1267,isanExteriorGatewayProtocol(EGP).Itallowsyoutosetupaninterdomainroutingsystemthatautomaticallyguaranteestheloop-freeexchangeofroutinginformationbetweenautonomoussystems.Forprotocol-independentfeatures,seethechapter“ConfiguringIPRoutingProtocol-IndependentFeatures”inthisbook.Toidentifythehardwareplatformorsoftwareimageinformationassociatedwithafeature,usetheFeatureNavigatoronCisco.comtosearchforinformationaboutthefeatureorrefertothesoftwarereleasenotesforaspecificrelease.Formoreinformation,seethe“IdentifyingSupportedPlatforms”sectioninthe“UsingCiscoIOSSoftware”chapterinthisbook.TheCiscoBGPImplementationInBGP,eachrouteconsistsofanetworknumber,alistofautonomoussystemsthatinformationhaspassedthrough(calledtheautonomoussystempath),andalistofotherpathattributes.WesupportBGPVersions2,3,and4,asdefinedinRFCs1163,1267,and1771,respectively.TheprimaryfunctionofaBGPsystemistoexchangenetworkreachabilityinformationwithotherBGPsystems,includinginformationaboutthelistofautonomoussystempaths.Thisinformationcanbeusedtoconstructagraphofautonomoussystemconnectivityfromwhichroutingloopscanbeprunedandwithwhichautonomoussystem-levelpolicydecisionscanbeenforced.YoucanconfigurethevaluefortheMultiExitDiscriminator(MED)metricattributeusingroutemaps.(ThenameofthismetricforBGPVersions2and3isINTER_AS_METRIC.)WhenanupdateissenttoaninternalBGP(iBGP)peer,theMEDispassedalongwithoutanychange.Thisactionenablesallthepeersinthesameautonomoussystemtomakeaconsistentpathselection.AnexthoprouteraddressisusedintheNEXT_HOPattribute,regardlessoftheautonomoussystemofthatrouter.TheCiscoIOSsoftwareautomaticallycalculatesthevalueforthisattribute.Transitive,optionalpathattributesarepassedalongtootherBGP-speakingrouters.ConfiguringBGPTheCiscoBGPImplementationIPC-294CiscoIOSIPConfigurationGuideBGPVersion4supportsclasslessinterdomainrouting(CIDR),whichletsyoureducethesizeofyourroutingtablesbycreatingaggregateroutes,resultinginsupernets.CIDReliminatestheconceptofnetworkclasseswithinBGPandsupportstheadvertisingofIPprefixes.CIDRroutescanbecarriedbyOpenShortestPathFirst(OSPF),EnhancedIGRP(EIGRP),andIntermediateSystem-to-IntermediateSystem(ISIS)-IP,andRoutingInformationProtocol(RIP).Seethe“BGPRouteMapExamples”sectionattheendofthischapterforexamplesofhowtouseroutemapstoredistributeBGPVersion4routes.HowBGPSelectsPathsArouterrunningCiscoIOSRelease12.0orlaterdoesnotselectoruseaniBGProuteunlessbothofthefollowingconditionsaretrue:•Therouterhasarouteavailabletothenexthoprouter:•TherouterhasreceivedsynchronizationviaanIGP(unlessIGPsynchronizationhasbeendisabled).BGPbasesitsdecisionprocessontheattributevalues.Whenfacedwithmultipleroutestothesamedestination,BGPchoosesthebestrouteforroutingtraffictowardthedestination.ThefollowingprocesssummarizeshowBGPchoosesthebestroute.1.Ifthenexthopisinaccessible,donotconsiderit.ThisdecisioniswhyitisimportanttohaveanIGProutetothenexthop.2.Ifthepathisinternal,synchronizationisenabled,andtherouteisnotintheIGP,donotconsidertheroute.3.Preferthepathwiththelargestweight(weightisaCiscoproprietaryparameter).4.Iftherouteshavethesameweight,prefertheroutewiththelargestlocalpreference.5.Iftherouteshavethesamelocalpreference,prefertheroutethatwasoriginatedbythelocalrouter.Forexample,aroutemightbeoriginatedbythelocalrouterusingthenetworkbgprouterconfigurationcommand,orthroughredistributionfromanIGP.6.Ifthelocalpreferenceisthesame,orifnoroutewasoriginatedbythelocalrouter,prefertheroutewiththeshortestautonomoussystempath.7.Iftheautonomoussystempathlengthisthesame,prefertheroutewiththelowestorigincode(IGPEGPINCOMPLETE).8.Iftheorigincodesarethesame,prefertheroutewiththelowestMEDmetricattribute.Thiscomparisonisonlymadeiftheneighboringautonomoussystemisthesameforallroutesconsidered,unlessthebgpalways-compare-medrouterconfigurationcommandisenabled.NoteThemostrecentInternetEngineeringTaskForce(IETF)decisionregardingBGPMEDassignsavalueofinfinitytothemissingMED,makingtheroutelackingtheMEDvariabletheleastpreferred.ThedefaultbehaviorofBGProutersrunningCiscoIOSsoftwareistotreatrouteswithouttheMEDattributeashavingaMEDof0,makingtheroutelackingtheMEDvariablethemostpreferred.ToconfiguretheroutertoconformtotheIETFstandard,usethebgpbestpathmedmissing-as-worstrouterconfigurationcommand.9.PrefertheexternalBGP(eBGP)pathovertheiBGPpath.Allconfederationpathsareconsideredinternalpaths.ConfiguringBGP