BGP实验

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

BGP实验1.BGP邻居建立BGP邻居分为IBGP与EBGP两种;IBGP邻居通常使用loopback接口的地址建立邻居关系,可以非直连。Routerbgp100nei2.2.2.2remote-as100nei2.2.2.2ebgp-multihopnei2.2.2.2update-sourceloopback1EBGP邻居通常是直连的(也可以非直连),因此使用直连端口的IP地址建立邻居关系,也可以使用loopback接口建立邻居关系,但是需要配置EBGP多跳,因为EBGP默认跳数是1。Routerbgp100nei2.2.2.2remote-as200nei2.2.2.2ebgp-multihopnei2.2.2.2update-sourceloopback1其中,2.2.2.2必须是可达的,可以使用静态路由的方式实现。2.BGP同步BGP的通告原则:BGPSpeaker从IBGP获得的路由是否通告给它的EBGP相邻体要依IGP和BGP同步的情况来决定。如果R4上关闭同步,在R5上可以看到R4传递过来的1.1.1.1的路由:R5#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3245.1.1.10200100i在R4上开启同步,在R5上查看showipbgp,看不到1.1.1.1路由。R4从IBGP邻居2.2.2.2学到R1发布的1.1.1.1的路由,是否传递给EBGP邻居,要看BGP与IGP同步的情况而定,也就是说R4的IGP中没有学习到1.1.1.1的路由,那么BGP与IGP不同步,所以不会把1.1.1.1的路由传递给EBGP邻居。开启R4同步,并配置静态路由iproute1.1.1.1255.255.255.2552.2.2.2后,R4会将1.1.1.1通告给R5。一般在现网中不会有这样的网络结构,因此,为了避免路由不能正确通告,我们一般将同步功能关掉。BGP的属性分为公认属性和可选属性;公认属性是所有路由器都认识的属性;公认属性有分为公认必遵和公认自决两种,公认必遵属性是每个update报文中传递的路由都必须携带的属性;例如:路由起源(origin),ASPath,下一跳属性;公认自决属性可以携带,也可以没有,例如:本地优先属性。可选属性是BGP路由器可以支持,也可以不支持的属性,分为可选传递和可选非传递,可选传递的属性如community属性,可以被BGP的路由器一跳一跳的传递下去;可选非传递属性,如MED属性,不能传递给下一跳的BGP路由器。3.BGP路由起源属性Network:显示为i,选路时优先级高;Redistribute:显示为?4.BGPAS属性1)过滤私有AS应用场景:各地市城域网使用私有AS号,连入骨干网后,路由需要传入骨干网,但私有AS号需要隐藏。在R3上配置:routerbgp100neighbor23.1.1.1remote-as65501neighbor34.1.1.2remote-as200neighbor34.1.1.2remove-private-as//R3向R4通告时,将私有AS号去掉注:私有AS需要连续,如果R1所在的AS是公有AS的话,配置此命令,无法将R2所在的私有AS号去除。在R4上看到的结果:R4#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3234.1.1.10100i*2.2.2.2/3234.1.1.10100i2)增加AS使用场景:BGP通过AS路径的距离来决策路由,因此,可以使用增加AS号的方式来改变BGP的选路。在R3上配置:routerbgp100neighbor34.1.1.2route-mapaaout//在R3向R4传递路由时,应用策略路由aaroute-mapaasetas-pathprepend1020//配置策略路由,设置增加AS号10和20在R4上看到的结果:R4#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3234.1.1.101001020i*2.2.2.2/3234.1.1.101001020i5.BGP本地优先属性与IBGP邻居之间运用localpreference属性选择路由,只能是在AS内部情况;本地优先属性值越大越优先。在R4上配置:routerbgp200nosynchronizationbgplog-neighbor-changesneighbor24.1.1.1remote-as200neighbor24.1.1.1route-mapaainneighbor34.1.1.1remote-as200noauto-summaryroute-mapaapermit10setlocal-preference200//配置策略路由,将本地优先属性配置为2006.BGPMED属性与EBGP邻居之间传递MED属性选择路由,不能传递。在R2上配置:routerbgp200nosynchronizationbgplog-neighbor-changesneighbor12.1.1.1remote-as100neighbor23.1.1.2remote-as200neighbor24.1.1.2remote-as300neighbor24.1.1.2route-mapaaoutnoauto-summaryroute-mapaasetmetric50在R4上查看结果:R4#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3224.1.1.1500200100i*34.1.1.10200100i7.RR配置R1和R2配置为RR:routerbgp100nosynchronizationbgpcluster-id1.1.1.1//两台RR配置相同的ClusterID,防止RR之间路由环路;bgplog-neighbor-changesneighbor2.2.2.2remote-as100neighbor2.2.2.2update-sourceLoopback1neighbor3.3.3.3remote-as100neighbor3.3.3.3update-sourceLoopback1neighbor3.3.3.3route-reflector-clientneighbor4.4.4.4remote-as100neighbor4.4.4.4update-sourceLoopback1neighbor4.4.4.4route-reflector-clientneighbor5.5.5.5remote-as100neighbor5.5.5.5update-sourceLoopback1neighbor5.5.5.5route-reflector-clientnoauto-summary8.对等体组配置前例中R1的配置可以简化为:routerbgp100nosynchronizationbgpcluster-id1.1.1.1bgplog-neighbor-changesneighborCLIENTpeer-group//创建对等体组CLIENT,属性配置给CLIENTneighborCLIENTremote-as100neighborCLIENTupdate-sourceLoopback1neighborCLIENTroute-reflector-clientneighbor3.3.3.3peer-groupCLIENT//再将邻居加入到对等体组中,可简化配置neighbor4.4.4.4peer-groupCLIENTneighbor5.5.5.5peer-groupCLIENTnoauto-summary9.BGP联盟BGP的联盟与RR作用类似,为了减少大型AS内部IBGP邻居全部FullMesh连接。将一个大的AS划分成多个子AS。子AS之间传递路由时,下一跳不更改,类似于IBGP邻居之间传递路由。所以需要添加next-hop-self的命令。R1:routerbgp100nosynchronizationbgplog-neighbor-changesnetwork1.1.1.1mask255.255.255.255neighbor12.1.1.2remote-as200noauto-summaryR2:routerbgp64512nosynchronizationbgplog-neighbor-changesbgpconfederationidentifier200neighbor12.1.1.1remote-as100neighbor23.1.1.2remote-as64512neighbor23.1.1.2next-hop-selfnoauto-summaryR3:routerbgp64512nosynchronizationbgplog-neighbor-changesbgpconfederationidentifier200bgpconfederationpeers64513neighbor23.1.1.1remote-as64512neighbor34.1.1.2remote-as64513neighbor34.1.1.2next-hop-selfnoauto-summaryR4:routerbgp64513nosynchronizationbgplog-neighbor-changesbgpconfederationidentifier200bgpconfederationpeers64512neighbor34.1.1.1remote-as64512neighbor45.1.1.2remote-as300noauto-summaryR5:routerbgp300nosynchronizationbgplog-neighbor-changesneighbor45.1.1.1remote-as200noauto-summaryR5:R5#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3245.1.1.10200100iR4:R4#showipbgpNetworkNextHopMetricLocPrfWeightPath*1.1.1.1/3234.1.1.101000(64512)100iR3#showipbgpNetworkNextHopMetricLocPrfWeightPath*i1.1.1.1/3223.1.1.101000100i10.community属性配置no-advertise:不通告路由no-export:不通告路由给EBGP邻居(联盟内的子AS成员可以通告)local-as:只通告给IBGP邻居,包括联盟内的子AS成员也不通告R1:access-list1permit1.1.1.2access-list2permit1.1.1.3access-list3permit1.1.1.4!route-mapaapermit10matchipaddress1setcommunityno-advertise!route-mapaapermit20matchipaddress2setcommunityno-export!route-mapaapermit30matchipaddress3setcommunitylocal-AS!route-mapaapermit40routerbgp100nosynchronizationbgplog-neighbor-changesnetwork1.1.1.1mask255.255.255.255network1.1.1.2mask255.255.255.255network1.1.1.3mask255.255.255.255network1.1.1.

1 / 11
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功