码迷,mamicode.com
首页 > 其他好文 > 详细

BGP路由黑洞

时间:2020-09-23 23:38:14      阅读:35      评论:0      收藏:0      [点我收藏+]

标签:解决   number   下一跳   int   router   code   ext   alt   next   

技术图片
IP地址如图所示;
AR1和AR2配置EBGP,AR4和AR5也配置EBGP,AR2和AR4配置IBGP;
根据BGP选路原则4:(一条从IBGP学习到的路由发给BGP邻居之前,通过IGP必须知道该路由,即IGP与BGP同步)。在华为路由器上,默认是将BGP于IGP的同步检查关闭的,原因是为了实现IBGP路由的正常通告。但关闭同步会出现“路由黑洞”。因此有两种解决方案:1.将BGP路由引入IGP,2.IBGP路由器必须全互联。
BGP配置

AR1配置:
bgp 10
 router-id 10.0.1.1
 peer 10.0.12.2 as-number 20 
 ipv4-family unicast
  undo synchronization
  network 10.0.1.1 255.255.255.255 
  network 10.0.12.0 255.255.255.0 
  peer 10.0.12.2 enable

配置next-hop-local原因是:IBGP从EBGP学习到路由下一跳不变,会导致下一跳不可达,所以IBGP配置local,告知下一跳是自己。

AR2:
bgp 20
router-id 10.0.2.2
 peer 10.0.4.4 as-number 20 
 peer 10.0.4.4 connect-interface LoopBack0
 peer 10.0.12.1 as-number 10 
 ipv4-family unicast
  undo synchronization
  peer 10.0.4.4 enable
  peer 10.0.4.4 next-hop-local 
  peer 10.0.12.1 enable
AR4:
bgp 20
 router-id 10.0.4.4
 peer 10.0.2.2 as-number 20 
 peer 10.0.2.2 connect-interface LoopBack0
 peer 10.0.45.5 as-number 30 
 ipv4-family unicast
  undo synchronization
  peer 10.0.2.2 enable
  peer 10.0.2.2 next-hop-local 
  peer 10.0.45.5 enable
AR5:
bgp 30
 router-id 10.0.5.5
 peer 10.0.45.4 as-number 20 
 ipv4-family unicast
  undo synchronization
  network 10.0.5.5 255.255.255.255 
  network 10.0.45.0 255.255.255.0 
  peer 10.0.45.4 enable    

AR2,AR3,AR4配置OSPF 1

ospf 1 router-id 10.0.0.2 
 area 0.0.0.0 
  network 10.0.2.2 0.0.0.0 
  network 10.0.23.0 0.0.0.255 

ospf 1 router-id 10.0.0.3
 area 0.0.0.0 
  network 10.0.3.3 0.0.0.0 
  network 10.0.23.0 0.0.0.255 
  network 10.0.34.0 0.0.0.255

ospf 1 router-id 10.0.0.4
 area 0.0.0.0 
  network 10.0.4.4 0.0.0.0 
  network 10.0.34.0 0.0.0.255
根据BGP第四条选路原则,当IBGP学到的路由传递给BGP邻居之前通过IGP必须知道该路由,也就是说,AR2学习到的AR1的的路由传递给AR4时,改路由经过AR3,AR3必须知道AR1的路由;同理也必须知道AR5的路由,可以通过IBGP全互联和OSPF 引入BGP解决此问题;
办法1 ospf引入bgp(如果是公网bgp,不建议这么搞,除非你路由器和运维能力很牛逼):

AR2和AR4分别:
bgp 20
import-route bgp

办法2 IBGP全互联:

AR2:
bgp 20
 router-id 10.0.2.2
 peer 10.0.3.3 as-number 20 
 peer 10.0.3.3 connect-interface LoopBack0
 peer 10.0.4.4 as-number 20 
 peer 10.0.4.4 connect-interface LoopBack0
 ipv4-family unicast
  undo synchronization
  peer 10.0.3.3 enable
  peer 10.0.3.3 next-hop-local 
  peer 10.0.4.4 enable
  peer 10.0.4.4 next-hop-local 
AR3:
bgp 20
 router-id 10.0.3.3
 peer 10.0.2.2 as-number 20 
 peer 10.0.2.2 connect-interface LoopBack0
 peer 10.0.4.4 as-number 20 
 peer 10.0.4.4 connect-interface LoopBack0
 ipv4-family unicast
  undo synchronization
  peer 10.0.2.2 enable
  peer 10.0.4.4 enable
  AR4:bgp 20
 router-id 10.0.4.4
 peer 10.0.2.2 as-number 20 
 peer 10.0.2.2 connect-interface LoopBack0
 peer 10.0.3.3 as-number 20 
 peer 10.0.3.3 connect-interface LoopBack0
 ipv4-family unicast
  undo synchronization
  peer 10.0.2.2 enable
  peer 10.0.2.2 next-hop-local 
  peer 10.0.3.3 enable
  peer 10.0.3.3 next-hop-local

BGP路由黑洞

标签:解决   number   下一跳   int   router   code   ext   alt   next   

原文地址:https://blog.51cto.com/19940820/2536316

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!