©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID1BGP路由选路原则详解V1.0学习总结,个人见解,如有错误欢迎改正!!!©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID2学习目标掌握BGP十三条选路原则的原理熟练掌握常见的BGP路由选路原则©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID3BGP路由选路原则1.Weight属性2.LocalPreference属性3.本地路由始发方式4.AS-Path长度5.Origin属性6.MED属性7.EBGP优于IBGP8.到达Next-hop的代价9.执行等价负载均衡10.EBGP路由接收的顺序11.路由的Router-ID12.Cluster-list长度13.配置的BGPPeer指定地址©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID4第一条:Weight属性比较原则及配置注意事项:Cisco私有,可通过关联Route-map方式进行配置,该值无法传递给其他BGPPeer,只能在本地使用.携带的Weight值越大,则该路由越优先.本地始发路由的默认值是32768,从其他BGPPeer学习过来的路由的默认值是0虽然Weight属性是Cisco私有的,但是很多厂商也是内置该属性(但无法显示及修改),这样就保证了本地始发的路由是最优先的,因为本地始发路由的”Weight”为32768,从其他BGPPeer学习过来的路由的”Weight”为0.©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID5第一条:Weight属性实验验证R2、R3分别通告10.0.0.0给R1R1将10.0.0.0使用network方式引入BGP10.0.0.0/810.0.0.0/810.0.0.0/8AS1AS2R3R1R2IBGPEBGP©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID6第一条:Weight属性实验验证R1的BGP表r1#shipbgpBGPtableversionis2,localrouterIDis9.9.0.1Statuscodes:ssuppressed,ddamped,hhistory,*valid,best,i-internal,rRIB-failure,SStaleOrigincodes:i-IGP,e-EGP,?-incompleteNetworkNextHopMetricLocPrfWeightPath*i10.0.0.09.9.13.301000i*9.9.12.2002i*0.0.0.0032768i©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID7第一条:Weight属性实验验证R1对BGPPeer应用不同的Route-map修改所学习路由的Weight值10.0.0.0/810.0.0.0/810.0.0.0/8AS1AS2R3R1R2IBGPEBGProuterbgp1---R1的路由策略neighbor9.9.12.2route-mapFROM_R2inroute-mapFROM_R2permit10setweight65535©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID8第一条:Weight属性实验验证R1的BGP表选路结果r1#shipbgpBGPtableversionis7,localrouterIDis9.9.0.1Statuscodes:ssuppressed,ddamped,hhistory,*valid,best,i-internal,rRIB-failure,SStaleOrigincodes:i-IGP,e-EGP,?-incompleteNetworkNextHopMetricLocPrfWeightPathri10.0.0.09.9.13.301000ir9.9.12.20655352ir0.0.0.0032768i©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID9BGP路由选路原则1.Weight属性2.LocalPreference属性3.本地路由始发方式4.AS-Path长度5.Origin属性6.MED属性7.EBGP优于IBGP8.到达Next-hop的代价9.执行等价负载均衡10.EBGP路由接收的顺序11.路由的Router-ID12.Cluster-list长度13.配置的BGPPeer指定地址©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID10第二条:LocalPreference属性比较原则及配置注意事项:值越大,越优先默认情况下,本地始发的路由的LP为100,从EBGPPeer接收的路由的LP为100.LocalPreference属性只能在IBGPPeer之间传递,不能在EBGPPeer之间传递,如果在EBGPPeer之间收到的路由的路径属性中携带了LocalPreference,则会触发Notifacation报文,造成会话中断©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID11第二条:LocalPreference属性比较原则及配置注意事项:LocalPreference通过如下三种方法进行设置:−通过将IGP路由引入BGP时关联Route-map进行设置−针对IBGPPeer应用IN/OUT方向的Route-map,对从Peer接收到的或者通告给Peer的所有或部分路由进行设置−针对EBGPPeer应用IN方向的Route-map,对从Peer接收到的所有或部分路由进行设置LocalPreference为BGP选路策略中经常使用的一个路径属性©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID12第二条:LocalPreference属性实验一:LocalPrefenerce无法在EBGPPeer之间传递R1R2AS1AS210.0.0.0/8EBGProuterbgp2network10.0.0.0neighbor9.9.12.1remote-as1neighbor9.9.12.1route-mapTO_R1out!route-mapTO_R1permit10setlocal-preference500©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID13第二条:LocalPreference属性实验一:LocalPrefenerce无法在EBGPPeer之间传递查看本地始发的BGP路由的LP值r2#showipbgpBGPtableversionis2,localrouterIDis9.9.0.2Statuscodes:ssuppressed,ddamped,hhistory,*valid,best,i-internal,rRIB-failure,SStaleOrigincodes:i-IGP,e-EGP,?-incompleteNetworkNextHopMetricLocPrfWeightPath*10.0.0.00.0.0.0032768i空值?r2#shipb10.0.0.0BGProutingtableentryfor10.0.0.0/8,version2Paths:(1available,best#1,tableDefault-IP-Routing-Table)Advertisedtononpeer-grouppeers:9.9.12.1Local0.0.0.0from0.0.0.0(9.9.0.2)OriginIGP,metric0,localpref100,weight32768,valid,sourced,local,best©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID14第二条:LocalPreference属性实验一:LocalPrefenerce无法在EBGPPeer之间传递R2通告给R1的BGP路由是否携带LP?r1#shipbgpBGPtableversionis2,localrouterIDis9.9.0.1Statuscodes:ssuppressed,ddamped,hhistory,*valid,best,i-internal,rRIB-failure,SStaleOrigincodes:i-IGP,e-EGP,?-incompleteNetworkNextHopMetricLocPrfWeightPath*10.0.0.09.9.12.2002i500没有传递?r2#shipbgpneighbors9.9.12.1advertised-routesBGPtableversionis2,localrouterIDis9.9.0.2Statuscodes:ssuppressed,ddamped,hhistory,*valid,best,i-internal,rRIB-failure,SStaleOrigincodes:i-IGP,e-EGP,?-incompleteNetworkNextHopMetricLocPrfWeightPath*10.0.0.00.0.0.0032768i©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID15第二条:LocalPreference属性实验一:LocalPrefenerce无法在EBGPPeer之间传递R2通告给R1的BGPUpdate报文R2通告的10.0.0.0/8前缀的路径属性中不包含LocalPreference属性©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID16第二条:LocalPreference属性实验二:修改本地始发路由的默认LP值R1R2AS110.0.0.0/8IBGProuterbgp1---R2的路由策略bgpdefaultlocal-preference500network10.0.0.0neighbor9.9.12.1remote-as1©2007CiscoSystems,Inc.Allrightsreserved.CiscoConfidentialPresentation_ID17第二条:LocalPreference属性实验二:修改本地始发路由的默认LP值r2#shipbBGPtableversionis2,localrouterIDis10.0.0.1Statuscodes:ssuppresse