1. 程式人生 > >38-高級路由:BGP選路:環路預防

38-高級路由:BGP選路:環路預防

text onf cbe 發生 mask 選路 ref access ffffff

一、實驗拓撲:
技術分享圖片
Note:這裏只用R2、R3路由器
二、實驗要求:
1、R2身後增加Lo1:20.20.20.20,並宣告進BGP進程中;
2、R3上部署靜態路由 出接口(必須是,否則有繼承現象發生);
3、R3在BGP進程下宣告20.20.20.20;
4、R3上抓取流量,部署route-map,使得20.20.20.20最優路徑的下一跳是2.2.2.2
5、查看R3上20.20.20.20的路由下一跳是否是0.0.0.0?這樣是否有環路風險?
6、驗證:部署4、後,最優路徑的下一跳是否是2.2.2.2

三、命令部署:
1、2、3部署:
R2(config)#int lo1
R2(config-if)#ip add 20.20.20.20 255.255.255.0

R2(config)#router bgp 123
R2(config-router)#network 20.20.20.0 mask 255.255.255.0

R3(config)#ip route 20.20.20.0 255.255.255.0 f0/0

R3(config)#router bgp 123
R3(config-router)#network 20.20.20.0 mask 255.255.255.0

4、部署:
R3(config)#access-list 10 permit 20.20.20.0 0.0.0.255
R3(config)#route-map pl permit 10
R3(config-route-map)#match ip address 10

R3(config-route-map)#set weight 32768

R3(config-route-map)#route-map pl permit 20
R3(config-route-map)#match ip address 10
R3(config-route-map)#set local-preference 200
R3(config-route-map)#route-map permit 1000

R3(config)#router bgp 123
R3(config-router)#neighbor 2.2.2.2 route-map pl in

四、驗證:
1、2、3部署完成後驗證:
R3#show ip bgp

Network Next Hop Metric LocPrf Weight Path
*> 20.20.20.0/24 0.0.0.0 0 32768 I

  • i 2.2.2.2 0 100 0 i

R2#show ip bgp
Network Next Hop Metric LocPrf Weight Path

  • i20.20.20.0/24 3.3.3.3 0 100 0 i
    *> 0.0.0.0 0 32768 i
    4、部署完成後驗證:

技術分享圖片

38-高級路由:BGP選路:環路預防