BGP实验(DOC)_第1页
BGP实验(DOC)_第2页
免费预览已结束,剩余9页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、BGP实验1. BGP 邻居建立BGP 邻居分为 IBGP 与 EBGP 两种;IBGP 邻居通常使用 loopback 接口的地址建立邻居关系,可以非直连。Router bgp 100nei 2.2.2.2 remote-as 100nei 2.222 ebgp-multihopnei 2.2.2.2 update-source loopback 1EBGP 邻居通常是直连的(也可以非直连),因此使用直连端口的 IP 地址建立邻居关系,也可以使用 loopback 接口建立邻居关系,但是需要配置EBGP 多跳,因为 EBGP 默认跳数是 1。Router bgp 100nei 2.2.2.2

2、 remote-as 200nei 2.2.2.2 ebgp-multihopnei 2.2.2.2 update-source loopback 1其中,2.2.2.2 必须是可达的,可以使用静态路由的方式实现。2. BGP 同步BGP 的通告原则: BGPSpeaker 从 IBGP 获得的路由是否通告给它的EBGP 相邻体要依 IGP 和BGP 同步的情况来决定。如果 R4 上关闭同步,在 R5 上可以看到 R4 传递过来的 1.1.1.1 的路由:R5#show ip bgpR3f 1/0AS 655Q1AS 65500在 R4 上开启同步,在 R5 上查看 show ip bgp,看

3、不到 1.1.1.1 路由。R4 从 IBGP 邻居 2222 学到 R1 发布的 1.1.1.1 的路由,是否传递给 EBGP 邻居,要看 BGP 与BGP 的属性分为公认属性和可选属性;公认属性是所有路由器都认识的属性; 公认属性有分为公认必遵和公认自决两种, 公认必遵 属性是每个 update 报文中传递的路由都必须携带的属性; 例如:路由起源(origin), AS Path, 下一跳属性;公认自决属性可以携带,也可以没有,例如:本地优先属性。可选属性是 BGP 路由器可以支持,也可以不支持的属性,分为可选传递和可选非传递,可 选传递的属性如 community 属性,可以被 BGP

4、的路由器一跳一跳的传递下去; 可选非传递属性,如 MED 属性,不能传递给下一跳的BGP 路由器。3. BGP 路由起源属性Network :显示为 i,选路时优先级高;4. BGP AS 属性Next HopMetric LocPrf Weight Path开启 R4 同步,并配置静态路由ip route 1.1.1.1 255.255.255.255 2.2.2.2 后,R4 会将 1.1.1.1 通告给 R5。因此,为了避免路由不能正确通告,我们一般将同步AS 号,连入骨干网后,路由需要传入骨干网,Network* 1.1.1.1/321)过滤私有 AS但私有 AS 号需要隐藏。在 R4

5、上配置:router bgp 100neighbor 23.1.1.1 remote-as 65501neighbor 34.1.1.2 remote-as 200neighbor 34.1.1.2 remove-private-asR3 向 R4 通告时,将私有 AS 号去掉注:私有 AS 需要连续,如果 R1 所在的 AS 是公有 AS 的话,配置此命令,无 法将 R2所在的私有 AS 号去除。在 R4 上看到的结果:R4#show ip bgpNetworkNext Hop* 1.1.1.1/3234.1.1.1* 2.2.2.2/3234.1.1.12)增加 AS使用场景:BGP 通过

6、 AS 路径的距离来决策路由,因此,可以使用增加AS 号的方式来改变 BGP 的选路。在 R3 上配置:router bgp 100neighbor 34.1.1.2 route-map aa out /在 R3 向 R4 传递路由时,应用策略路由aaroute-map aaset as-path prepend 10 20/配置策略路由,设置增加AS 号 10 和 20在 R4 上看到的结果:R4#show ip bgpNetworkNext Hop* 1.1.1.1/3234.1.1.1* 2.2.2.2/3234.1.1.15. BGP 本地优先属性与 IBGP 邻居之间运用 local

7、 preferenee 属性选择路由,只能是在AS 内部情况;本地优先属性值越大越优先。Metric LocPrf Weight Path0 100 i0 100 iMetric LocPrf Weight Path0 100 10 20 i0 100 10 20 i在 R4 上配置:router bgp 200no synchroni zati onbgp log-neighbor-cha nges neighbor 24.1.1.1remote-as 200 n eighbor 24.1.1.1 route-map aa inneighbor 34.1.1.1 remote-as 200

8、no auto-summaryroute-map aa permit 10set local-prefere nee 2006. BGP MED 属 性与 EBGP 邻居之间传递 MED 属性选择路由,不能传递。/配置策略路由,将本地优先属性配置为200在 R2上配置:router bgp 200no synchroni zati onbgp log-neighbor-cha ngesneighbor 12.1.1.1 remote-as 100neighbor 23.1.1.2 remote-as 200neighbor 24.1.1.2 remote-as 300 neighbor 24.

9、1.1.2 route-map aa outno auto-summaryroute-map aa set metric 50Metric LocPrf Weight Path500 200 100 i0 200 100 i7. RR 配置R1 和 R2 配置为 RR:router bgp 100no synchroni zati onbgp cluster-id 1.1.1.1/两台 RR 配置相同的 Cluster ID,防止 RR 之间路由环路;bgp log-neighbor-cha ngesneighbor 2.2.2.2 remote-as 100n eighbor 2.2.2.2

10、 update-source Loopback1在 R4 上查看结果:R4#show ip bgpNetwork*1.1.1.1/32*Next Hop24.1.1.134.1.1.1RKl販2neighbor 3.3.3.3 remote-as 100n eighbor 3.3.3.3 update-source Loopbackl neighbor 3.3.3.3 route-reflector-clientneighbor 444.4 remote-as 100n eighbor 4.4.4.4 update-source Loopback1 neighbor 4.4.4.4 route

11、-reflector-clientn eighbor 5.5.5.5 remote-as 100n eighbor 5.5.5.5 update-source Loopback1 neighbor 5.5.5.5 route-reflector-client noauto-summary&对等体组配置前例中 R1 的配置可以简化为:router bgp 100no synchroni zati onbgp cluster-id 1.1.1.1bgp log-neighbor-cha ngesneighbor CLIENT peer-group/ 创建对等体组 CLIENT 属性配置给

12、CLIENTneighbor CLIENT remote-as 100neighbor CLIENT update-source Loopback1neighbor CLIENT route-reflector-clientneighbor 3.3.3.3 peer-group CLIENT/再将邻居加入到对等体组中,可简化配置neighbor 4.4.4.4 peer-group CLIENTn eighbor 5.5.5.5 peer-group CLIENTno auto-summary9.BGP 联盟BGP 的联盟与 RR 作用类似,为了减少大型 AS 内部 IBGP 邻居全部 Ful

13、l Mesh 连接。将一个大 的AS 划分成多个子 AS。子 AS 之间传递路由时,下一跳不更改,类似于next-hop-self 的命令。IBGP 邻居之间传递路由。所以需要添加R1:router bgp 100no synchroni zati onbgp log-n eighbor-cha ngesnetwork 1.1.1.1 mask 255.255.255.255neighbor 12.1.1.2 remote-as 200no auto-summaryR2:router bgp 64512no synchroni zati onbgp log-n eighbor-cha nges

14、bgp confederation identifier 200neighbor 12.1.1.1 remote-as 100neighbor 23.1.1.2 remote-as 64512neighbor 23.1.1.2 next-hop-self no auto-summaryR3:router bgp 64512no synchroni zati onbgp log-n eighbor-cha ngesbgp confederation identifier 200bgp con federati on peers 64513neighbor 23.1.1.1 remote-as 6

15、4512neighbor 34.1.1.2 remote-as 64513neighbor 34.1.1.2 next-hop-selfno auto-summaryR4:router bgp 64513no synchroni zati onbgp log-n eighbor-cha ngesAS 20Dbgp confederation identifier 200 bgp con federati on peers 64512neighbor 34.1.1.1 remote-as 64512 neighbor 45.1.1.2 remote-as300 no auto-summaryR5

16、:router bgp 300no synchroni zati onbgp log-n eighbor-cha nges neighbor 45.1.1.1 remote-as 200 noauto-summary10. community 属性配置no-advertise :不通告路由no-export:不通告路由给 EBGP 邻居(联盟内的子 AS 成员可以通告)local-as:只通告给 IBGP 邻居,包括联盟内的子 AS 成员也不通告R5:R5#show ip bgpNetwork* 1.1.1.1/32R4:R4#show ip bgpNetwork* 1.1.1.1/32R3#

17、show ip bgpNetwork*i1.1.1.1/32Next Hop45.1.1.1Next Hop34.1.1.1Next Hop23.1.1.1Metric LocPrf Weight Path0 200 100 iMetric LocPrf Weight Path01000 (64512) 100 iMetric LocPrf Weight Path01000 100 iR1:access-list 1 permit 1.1.1.2 access-list 2 permit 1.1.1.3 access-list 3 permit 1.1.1.4 !route-map aa pe

18、rmit 10 match ip address 1 set com munity no-advertise!route-map aa permit 20 match ip address 2 set com munity no-export!route-map aa permit 30 match ip address 3 set com munity local-AS!route-map aa permit 40 router bgp 100no synchroni zati onbgp log-n eighbor-cha ngesnetwork 1.1.1.1 mask 255.255.

19、255.255 network 1.1.1.2 mask 255.255.255.255 network 1.1.1.3 mask255.255.255.255 network 1.1.1.4 mask 255.255.255.255 neighbor 12.1.1.2 remote-as 200 n eighbor12.1.1.2 sen d-com munity n eighbor 12.1.1.2 route-map aa out no auto-summaryi3Path attri butes+ ORIGIN: IGP (4 bytes)田AS.PATH: 100 (7 bytes)

20、田NEXT_HOP: 23.1.1.1 (7 bytes)i)MULTI_EXIT_OISC: 0 (7 bytes)田LOCAL_PREF: 1007 bytes)田COMMUNITIES:NO.EXPORT (7 bytes)-Network layer reachabi1ity information: 5 bytes田1.1.1.3/32R2 向 R3 传递路由的时候,community 属性被继续传递。11路由聚合接上例;在 R1 上配置:router bgp 100no synchroni zati onbgp log-n eighbor-cha ngesAS 2MJAS 6451

21、2fd/o1.1.1.1LI1.2 I .31111l.L.1.31.1.1.4L.1.1.11.1.1.2 Dn-aA ertiic1.1. L.3 mo-ctpcrt.l.l.l.41ocal-ai).1.1.11.1.13/邻居继续传递此 AS 属性network 1.1.1.1 mask 255.255.255.255network 1.1.1.2 mask 255.255.255.255network 1.1.1.3 mask 255.255.255.255network 1.1.1.4 mask 255.255.255.255aggregate-address 1.1.1.0 25

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论