BGP路由黑洞解决的四种方法

  • 格式:docx
  • 大小:85.79 KB
  • 文档页数:5

为了防止AS内部形成IBGP路由环路,从而要求从IBGP学到的路由不会再传给其他IBGP邻居了,但是这样却造成了路由黑洞。那么怎么解决呢?可以用重分布实现同步,也就是bgp的路由能在igp路由表中看见。然而除非你了解后果,否则不允许bgp重分布到igp中,因为如果有几十万,几百万条路由,igp路由表就爆了,所以现在思科路由默认不采用同步。那怎么解决路由黑洞呢?

解决方法一:Full Mesh

分别在R2和R3,R3和R5上运行BGP ,这样R3就可以学到到达R1的路由,这时你需要在R1、R2、R3之间分别建立邻居关系,当路由器很多的时候,全互联要求建立n*(n-1)/2个邻居关系,这显然是很麻烦。(略)

解决方法二:Foute-Reflector

路由反射器,我们可以将R3做成一个路由反射器,使它能将从R1学的路由条目反射给R5,正常情况下为了防止环路,从IBGP学到的路由不会再传给其它IBGP邻居。 现在只需要在路由反射客户和路由反射器间建立邻居关系,邻居关系减少到n-1条。

路由反射器(RR)的条件:

1、如果路由是从非客户的IBGP学到的只反射给客户

2、如果路由是从客户学到的,将它反射给发起该路由的客户以外的所有非客户及客户

3、如果路由是从EBGP对等体学到的,将它反射给所有客户和非客户

做法:清除R2与R5的邻居关系,只在R2与R3、R3与R5之间建立IBGP关系 然后在R3的路由配置模式下:

neighbor 2.2.2.2 route-reflector-client

neighbor 5.5.5.5 route-reflector-client //将R2和R5作为RR的客户

此时R5上能收到关于R1的路由,它也会传给R7

解决方法三 :Confederation

联邦是将整个大的AS区域再划分成多个小的AS区域,比如现在有AS200就相当于中国,而整个中国显然可以再分为若干个省分,现在AS65012和AS65003 就是划分出来的“小AS”,意思这里的AS号是私有的,在出AS200时它将自动被去掉(64512--65535可用),这样划分后,R3和R5就为联邦EBGP邻居了,这时它关于R 1的路由条目就可以传给R5了。

R2:

router bgp 65012 //指定的联邦AS号

no synchronization

bgp log-neighbor-changes

bgp confederation identifier 200 //R2对外宣称自己的AS号为200,它会告诉R1它的AS号为200,因为65012是私有的

network 192.168.12.0

network 192.168.23.0 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.1 ebgp-multihop 255

neighbor 1.1.1.1 update-source Loopback0

neighbor 3.3.3.3 remote-as 65012

neighbor 3.3.3.3 update-source Loopback0

neighbor 3.3.3.3 next-hop-self

no auto-summary

R3:

r3#sh run | b r b

router bgp 65012

no synchronization

bgp log-neighbor-changes

bgp confederation identifier 200 //对R5稳定自己的AS号为200,它不会对R2宣称,因为它们属于同一个联邦AS

neighbor 2.2.2.2 remote-as 65012

neighbor 2.2.2.2 update-source Loopback0

neighbor 5.5.5.5 remote-as 65003

neighbor 5.5.5.5 ebgp-multihop 255

neighbor 5.5.5.5 update-source Loopback0

no auto-summary

!

R5:

router bgp 65003

no synchronization

bgp log-neighbor-changes

bgp confederation identifier 200 //对R3和R7宣称自己的AS号为200

neighbor 3.3.3.3 remote-as 65012

neighbor 3.3.3.3 ebgp-multihop 255

neighbor 7.7.7.7 remote-as 300

neighbor 7.7.7.7 ebgp-multihop 255 neighbor 7.7.7.7 update-source Loopback0

no auto-summary

!

这时查看R3和R5的邻居关系

r3#sh ip bgp su

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 65012 10 9 1 0 0 00:06:26 2

5.5.5.5 4 65003 1 1 0 0 0 never Active

发现在它们始终处于Active状态,不能完成邻居的建立,这又是为什么呢?

分析一下:

R5和R3都打了这条命令,bgp confederation identifier 200

又因为他们处于不同的联邦AS,所以它们都会宣称自己的AS号为200,然而我们看到它们的Neighbor却不是这样通告的

R3上:neighbor 5.5.5.5 remote-as 65003

R5上:neighbor 3.3.3.3 remote-as 65012

所以这时会报一个错误:AS号错误,如下

r5#

*Oct 19 12:20:10.311: %SYS-5-CONFIG_I: Configured from console by console

r5#

*Oct 19 12:20:19.155: %BGP-3-NOTIFICATION: sent to neighbor 3.3.3.3 2/2 (peer in

wrong AS) 2 bytes 00C8

r5# FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 002D 0104 00C8 00B4 0303 0303 1002

0601 0400 0100 0102 0280 0002 0202 00

解决方法:

R3上:bgp confederation peer 65003 // // 不对65003宣称自己的AS为200

R5上:bgp confederation peer 65012 // 不对65012宣称自己的AS为200

验证

r5#sh ip bgp BGP table version is 13, local router ID is 5.5.5.5

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

*> 1.1.1.0/24 2.2.2.2 0 100 0 (65012) 100 i

r> 7.7.7.0/24 7.7.7.7 0 0 300 i

*> 192.168.12.0 2.2.2.2 0 100 0 (65012) i

r> 192.168.23.0 3.3.3.3 0 100 0 (65012) i

*> 192.168.35.0 0.0.0.0 0 32768 i

* 3.3.3.3 0 100 0 (65012) i //括号中的是私有AS号,在出R5时会被去掉,在看7上可以看到效果

*> 192.168.57.0 0.0.0.0 0 32768 i

* 7.7.7.7 0 0 300 i

r7#sh ip bgp

BGP table version is 12, local router ID is 7.7.7.7

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

*> 1.1.1.0/24 5.5.5.5 0 200 100 i

*> 7.7.7.0/24 0.0.0.0 0 32768 i

*> 192.168.12.0 5.5.5.5 0 200 i

*> 192.168.23.0 5.5.5.5 0 200 i

*> 192.168.35.0 5.5.5.5 0 0 200 i

* 192.168.57.0 5.5.5.5 0 0 200 i