解决BGP中IBGP的路由黑洞的配置方法
Posted gelare
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决BGP中IBGP的路由黑洞的配置方法相关的知识,希望对你有一定的参考价值。
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的路由黑洞的配置方法的主要内容,如果未能解决你的问题,请参考以下文章