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

解决BGP中IBGP的路由黑洞的配置方法

时间:2020-04-07 12:38:02      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:反射   pac   date   tle   解决   pca   base   chm   one   

 

技术图片技术图片?

R1与R2间EBGP,R4与R5间EBGP,R2与R4间IBGP,但由于R3学不到相关的路由,造成路由黑洞。处理的方法主要以下几个:

以下是路由器配置:

R1:

interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.252
!
router bgp 100
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 192.168.1.2 remote-as 200

R5:

interface Loopback0
 ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/1
 ip address 192.168.1.14 255.255.255.252
 speed auto
 duplex auto
!
router bgp 300
 bgp log-neighbor-changes
 network 5.5.5.5 mask 255.255.255.255
 neighbor 192.168.1.13 remote-as 200

1、IBGP全连接

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

2、路由反射器

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 route-reflector-client
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 route-reflector-client

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

3、BGP邦连

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 65530
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65531
 neighbor 3.3.3.3 remote-as 65531

 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 65531
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65530 65532
 neighbor 2.2.2.2 remote-as 65530

 neighbor 2.2.2.2 ebgp-multihop 255
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 4.4.4.4 remote-as 65532
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
 speed auto
 duplex auto
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 65532
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65531
 neighbor 3.3.3.3 remote-as 65531

 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

4、配置MPLS

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
 mpls ip
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100
R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
 mpls ip
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
 mpls ip
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0


R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
 mpls ip
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 192.168.1.14 remote-as 300

5、BGP路由重分发到IGP(不建议)

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 redistribute bgp 200 subnets
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 redistribute bgp 200 subnets
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 192.168.1.14 remote-as 300

说明:
因为水平分割的抑制,BGP路由器从IBGP邻居收的路由不会再传递给IBGP邻居,这是为了防止环路的产生。即使R2与R3、R3与R4建立了邻居关系,在没有其他设置的情况下,R3也不会将R2传递来的路由传递给R4,同样R3也不会将R4传递过来的路由给R2。

 

解决BGP中IBGP的路由黑洞的配置方法

标签:反射   pac   date   tle   解决   pca   base   chm   one   

原文地址:https://www.cnblogs.com/gelare/p/12652424.html

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