《BGP路由策略与选路控制.doc》由会员分享,可在线阅读,更多相关《BGP路由策略与选路控制.doc(8页珍藏版)》请在课桌文档上搜索。
1、wordBGP路由策略与选路控制1、 实验目标:根据BGP路由选择原如此,用BGP属性控制BGP路由2、 网络拓扑图:3、 配置:IP地址如下列图用OSPF实现IGP路由可达BGP配置如下:no synchronization No auto-summary Update-source lo0 Next-hop-self R3和R4为同簇路由反射器,R1,R2分别为R3和R4的客户端 R3,R4建立普通IBGP邻居 R1与R5,R2与R6建立EBGP现分析下面路由RT1#show ip bgp Network Next Hop Metric LocPrf Weight Path* 10.0.1
2、5.2 0 0 65001 i* 10.0.15.2 0 0 65001 i根据EBGP路由优先于IBGP路由BGP routing table entry for 10.5.0.0/16, version 11Paths: (2 available, best #2, table Default-IP-Routing-Table) Advertised to update-groups: 2 65001 10.0.0.2 (metric 101) from 10.0.0.4 (10.0.0.4) Origin IGP, metric 0, localpref 100, valid, inte
3、rnal 65001 10.0.15.2 from (10.5.0.1) Origin IGP, metric 0, localpref 100, valid, external, bestRT2#show ip bgp R2同R1 Network Next Hop Metric LocPrf Weight Path* i 10.0.0.1 0 100 0 65001 i* i 10.0.0.1 0 100 0 65001 iBGP routing table entry for 10.5.0.0/16, version 10Paths: (2 available, best #1, tabl
4、e Default-IP-Routing-Table) Advertised to update-groups: 2 65001 10.0.26.2 from (10.6.0.1) Origin IGP, metric 0, localpref 100, valid, external, best 65001 10.0.0.1 (metric 101) from 10.0.0.3 (10.0.0.3) Origin IGP, metric 0, localpref 100, valid, internalRT3#show ip bgp Network Next Hop Metric LocPr
5、f Weight Path* i 10.0.0.2 0 100 0 65001 i*i 10.0.0.1 0 100 0 65001 i* i 10.0.0.2 0 100 0 65001 i*i 10.0.0.1 0 100 0 65001 i根据到达下一跳IGP开销小的BGP routing table entry for 10.5.0.0/16, version 18Paths: (3 available, best #3, table Default-IP-Routing-Table) Advertised to update-groups: 1 2 65001, (Received
6、from a RR-client) 10.0.0.2 (metric 201) from Origin IGP, metric 0, localpref 100, valid, internal 65001 10.0.0.2 (metric 201) from 10.0.0.4 (10.0.0.4) Origin IGP, metric 0, localpref 100, valid, internalOriginator: 10.0.0.2, Cluster list: 10.0.0.4 10.0.0.4反射得来,只反射最优路由 65001, (Received from a RR-clie
7、nt) 10.0.0.1 (metric 101) from Origin IGP, metric 0, localpref 100, valid, internal, best注:R3上该路由的最优路由来自RT1,所以不会反射回给RT1 同理,RT4不会反射给RT2RT4#show ip bgp R4同R3 Network Next Hop Metric LocPrf Weight Path* i 10.0.0.1 0 100 0 65001 i* i 10.0.0.1 0 100 0 65001 i* i 10.0.0.1 0 100 0 65001 i* i 10.0.0.1 0 100
8、 0 65001 iRT4#show ip bgp 10.5.0.0 BGP routing table entry for 10.5.0.0/16, version 8Paths: (3 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 2 65001, (Received from a RR-client) 10.0.0.2 (metric 101) from 10.0.0.2 (10.0.0.2) Origin IGP, metric 0, localpref 100, v
9、alid, internal, best 6500110.0.0.1 (metric 201) from 10.0.0.3 (10.0.0.3) Origin IGP, metric 0, localpref 100, valid, internal 65001, (Received from a RR-client) 10.0.0.1 (metric 201) from 10.0.0.1 (10.0.0.1) Origin IGP, metric 0, localpref 100, valid, internalR5、R6选路根据EBGP路由优先于IBGP路由RT5#show ip bgp
10、Network Next Hop Metric LocPrf Weight Path* 10.0.15.1 0 65000 i* 10.0.15.1 0 65000 i* 10.0.15.1 0 65000 i* 10.0.15.1 0 65000 iRT6#show ip bgp Network Next Hop Metric LocPrf Weight Path* 10.0.26.1 0 65000 i* 10.0.26.1 0 65000 i* 10.0.26.1 0 65000 i* 10.0.26.1 0 65000 i现将R3,R4参加到同一个簇,这样R3不会反射给R4,R4也不会
11、反射给R3因为Cluster list同为10.0.0.3,防环RT4(config)#router bgp 65000RT4#show ip bgp Network Next Hop Metric LocPrf Weight Path* i 10.0.0.1 0 100 0 65001 i* i 10.0.0.1 0 100 0 65001 i方案一:调节本地优先级本地优先级 local-preference默认为100,越大越优先,调节 local-preference控制路由将RT1从RT5收到的10.5.0.0/16路由本地优先级设为300,大于RT2的100将RT2从RT6收到的10
12、.6.0.0/16路由本地优先级设为300,大于RT1的100RT1(config)#RT1(config)#route-map rt1 permit 10 RT1(config-route-map)#match ip address prefix-list p3RT1(config-route-map)#set local-preference 300 设置该路由优先级为300RT1(config)#route-map rt1 permit 20 覆盖route-map的隐含拒绝RT1(config)#router bgp 65000RT1(config-router)#RT2(config
13、)#RT2(config)#route-map rt2 permit 10RT2(config-route-map)#match ip address prefix-list p3RT2(config-route-map)#set local-preference 300RT2(config)#route-map rt2 permit 20RT2(config)#router bgp 65000RT2(config-router)#neighbor 10.0.26.2 route-map rt2 inRT1#clear ip bgp *RT2#clear ip bgp * 必须要去除BGP邻居
14、重新建立RT1#show ip bgp Network Next Hop Metric LocPrf Weight Path* i 10.0.0.2 0 300 0 65001 i* 10.0.15.2 0 0 65001 iLocPrf为300,来自EBGPLocPrf为300,来自R2,优于来自RT2#show ip bgp Network Next Hop Metric LocPrf Weight Path* i 10.0.0.1 0 300 0 65001 i* 10.0.26.2 0 0 65001 iLocPrf为300,EBGP10.0.26.2 RT3#show ip bgp
15、Network Next Hop Metric LocPrf Weight PathRT4#show ip bgp方案二:调节MEDBGP路由默认MED值为0,越小越优先RT1(config)#route-map med permit 10 RT1(config-route-map)#match ip add prefix-list bluefoxRT1(config-route-map)#set metric 789 设置MED RT1(config)#route-map med permit 20 覆盖隐含拒绝RT1(config)#router bgp 65000RT1(config-r
16、outer)#neighbor 10.0.15.2 route-map med out 运用于邻居10.0.15.2 OUT方向RT2(config)#RT2(config)#route-map med permit 10RT2(config-route-map)#match ip address prefix-list bluefoxRT2(config-route-map)#set metric 666RT2(config)#route-map med permit 20RT2(config)#router bgp 65000RT2(config-router)#neighbor 10.0
17、.26.2 route-map med out RT5#show ip bgp Network Next Hop Metric LocPrf Weight Path* 10.0.15.1 789 0 65000 i MED为789* 10.0.15.1 789 0 65000 iRT6#show ip bgp Network Next Hop Metric LocPrf Weight Path*i 10.5.0.1 0 100 0 65000 i方案三:增加ASRT1(config)#route-map as permit 10RT1(config-route-map)#match ip ad
18、dress prefix-list bluefoxRT1(config-route-map)#set as-path prepend 65000 65000 65000 增as-pathRT1(config)#route-map as permit 20RT1(config)#router bgp 65000RT1(config-router)#neighbor 10.0.15.2 route-map as out RT2(config)#RT2(config)#route-map as permit 10RT2(config-route-map)#match ip address prefi
19、x-list bluefox RT2(config-route-map)#set as-path prepend 65000 65000RT2(config)#route-map as permit 20RT2(config)#router bgp 65000RT2(config-router)#neighbor 10.0.26.2 route-map as outRT5#show ip bgp Network Next Hop Metric LocPrf Weight Path* 10.0.15.1 0 65000 65000 65000 65000 i* 10.0.15.1 0 65000 65000 65000 65000 iRT6#show ip bgp Network Next Hop Metric LocPrf Weight Path* 10.0.26.1 0 65000 65000 65000 i4、 总结:配置完成是刚刚开始分析每一条路由怎么来的,根据网络需要控制路由选路,熟练掌握路由策略的工具分析链路故障会出现什么问题,如何解决8 / 8