非直连IBGP邻居路由更新的解决办法(一)-------路由反射器_第1张图片

如上图所示,R1/R2/R3在同一个IBGP内,这种情况下,路由更新,从IBGP邻居学习的路由不会被传递给其他的IBGP邻居。这样的解决办法有三种:

1、IBGP完全互连  

2、路由反射器 (Route Reflector) 

3、联盟

案例一、非直连邻居通过路由反射器(直连邻居省略)

R1配置信息:

interface Loopback10

 ip address 10.1.1.1 255.255.255.0

!

interface Loopback100

 ip address 100.1.1.1 255.255.255.0

!

interface FastEthernet0/0

 ip address 1.1.1.1 255.255.255.0

 duplex auto

 speed auto

router bgp 100

 no synchronization

 bgp log-neighbor-changes

 network 10.1.1.0 mask 255.255.255.0

 network 100.1.1.0 mask 255.255.255.0

 neighbor 20.1.1.1 remote-as 100

 neighbor 20.1.1.1 update-source loopback 10

 no auto-summary

!

ip route 20.1.1.0 255.255.255.0 1.1.1.2


R2配置信息:

interface Loopback20

 ip address 20.1.1.1 255.255.255.0

!

interface FastEthernet0/0

 ip address 1.1.1.2 255.255.255.0

 duplex auto

 speed auto

!

interface FastEthernet0/1

 ip address 2.2.2.2 255.255.255.0

 duplex auto

 speed auto

!

router bgp 100

 no synchronization

 bgp log-neighbor-changes

 network 1.1.1.0 mask 255.255.255.0

 network 2.2.2.0 mask 255.255.255.0

 network 20.1.1.0 mask 255.255.255.0

 neighbor 2.2.2.3 remote-as 100

 neighbor 2.2.2.3 route-reflector-client

 neighbor 10.1.1.1 remote-as 100

 neighbor 10.1.1.1 update-source Loopback20

 neighbor 10.1.1.1 route-reflector-client

 no auto-summary

!

ip classless

ip route 10.1.1.0 255.255.255.0 1.1.1.1


R3配置信息:

interface Loopback30

 ip address 30.1.1.1 255.255.255.0

!

interface FastEthernet0/1

 ip address 2.2.2.3 255.255.255.0

 duplex auto

 speed auto

!

router bgp 100

 no synchronization

 bgp log-neighbor-changes

 network 30.1.1.0 mask 255.255.255.0

 neighbor 2.2.2.2 remote-as 100

 no auto-summary


查看R1的路由信息:

R1#show ip route

*Mar 14 08:16:33.956: %SYS-5-CONFIG_I: Configured from console by console

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, FastEthernet0/0

     2.0.0.0/24 is subnetted, 1 subnets

B       2.2.2.0 [200/0] via 20.1.1.1, 02:47:19

     100.0.0.0/24 is subnetted, 1 subnets

C       100.1.1.0 is directly connected, Loopback100

     20.0.0.0/24 is subnetted, 1 subnets

S       20.1.1.0 [1/0] via 1.1.1.2

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, Loopback10

     30.0.0.0/24 is subnetted, 1 subnets

B       30.1.1.0 [200/0] via 2.2.2.3, 02:42:23

R1#show ip bgp

BGP table version is 50, local router ID is 100.1.1.1

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

r>i1.1.1.0/24       20.1.1.1                 0    100      0 i

*>i2.2.2.0/24       20.1.1.1                 0    100      0 i

*> 10.1.1.0/24      0.0.0.0                  0         32768 i

r>i20.1.1.0/24      20.1.1.1                 0    100      0 i

*>i30.1.1.0/24      2.2.2.3                  0    100      0 i

*> 100.1.1.0/24     0.0.0.0                  0         32768 i


R2的路由信息:

R2#show ip bgp

BGP table version is 8, local router ID is 20.1.1.1

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       0.0.0.0                  0         32768 i

*> 2.2.2.0/24       0.0.0.0                  0         32768 i

r>i10.1.1.0/24      10.1.1.1                 0    100      0 i

*> 20.1.1.0/24      0.0.0.0                  0         32768 i

*>i30.1.1.0/24      2.2.2.3                  0    100      0 i

*>i100.1.1.0/24     10.1.1.1                 0    100      0 i

R2#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, FastEthernet0/0

     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, FastEthernet0/1

     100.0.0.0/24 is subnetted, 1 subnets

B       100.1.1.0 [200/0] via 10.1.1.1, 00:01:57

     20.0.0.0/24 is subnetted, 1 subnets

C       20.1.1.0 is directly connected, Loopback20

     10.0.0.0/24 is subnetted, 1 subnets

S       10.1.1.0 [1/0] via 1.1.1.1

     30.0.0.0/24 is subnetted, 1 subnets

B       30.1.1.0 [200/0] via 2.2.2.3, 00:01:50

R2#show ip bgp 100.1.1.0

BGP routing table entry for 100.1.1.0/24, version 6

Paths: (1 available, best #1, table Default-IP-Routing-Table)

  Advertised to non peer-group peers:

  2.2.2.3           -----表示把100.1.1.0/24的路由发布给IBGP邻居2.2.2.3

  Local, (Received from a RR-client)

    10.1.1.1 from 10.1.1.1 (100.1.1.1)

      Origin IGP, metric 0, localpref 100, valid, internal, best

R3的路由信息:

R3#show ip bgp

BGP table version is 6, local router ID is 30.1.1.1

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

*>i1.1.1.0/24       2.2.2.2                  0    100      0 i

r>i2.2.2.0/24       2.2.2.2                  0    100      0 i

* i10.1.1.0/24      10.1.1.1                 0    100      0 i

*>i20.1.1.0/24      2.2.2.2                  0    100      0 i

*> 30.1.1.0/24      0.0.0.0                  0         32768 i

* i100.1.1.0/24     10.1.1.1                 0    100      0 i

R3#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets

B       1.1.1.0 [200/0] via 2.2.2.2, 00:03:03

     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, FastEthernet0/1

     20.0.0.0/24 is subnetted, 1 subnets

B       20.1.1.0 [200/0] via 2.2.2.2, 00:03:03

     30.0.0.0/24 is subnetted, 1 subnets

C       30.1.1.0 is directly connected, Loopback30

可以看到R3上通告的100.1.1.0/24和10.1.1.0/24 网段路由虽然通过BGP学习成功,但是在路由加载的时候添加路由失败,R3上未学习到next hop。

因为在路由同步的规则当中,需要把IGP的路由必须同步到IBGP,如果不能同步就会造成路由黑洞。因此需要在R2上把静态路由重分布

在R2上配置信息:

router bgp 100

 no synchronization

 bgp log-neighbor-changes

 network 1.1.1.0 mask 255.255.255.0

 network 2.2.2.0 mask 255.255.255.0

 network 20.1.1.0 mask 255.255.255.0

 redistribute static metric 10

 neighbor 2.2.2.3 remote-as 100

 neighbor 2.2.2.3 route-reflector-client

 neighbor 10.1.1.1 remote-as 100

 neighbor 10.1.1.1 update-source Loopback20

 neighbor 10.1.1.1 route-reflector-client

 no auto-summary


R3的路由信息:

R3#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets

B       1.1.1.0 [200/0] via 2.2.2.2, 00:12:08

     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, FastEthernet0/1

     100.0.0.0/24 is subnetted, 1 subnets

B       100.1.1.0 [200/0] via 10.1.1.1, 00:00:01

     20.0.0.0/24 is subnetted, 1 subnets

B       20.1.1.0 [200/0] via 2.2.2.2, 00:12:08

     10.0.0.0/24 is subnetted, 1 subnets

B       10.1.1.0 [200/10] via 1.1.1.1, 00:00:11

     30.0.0.0/24 is subnetted, 1 subnets

C       30.1.1.0 is directly connected, Loopback30

R3#show ip bgp

BGP table version is 8, local router ID is 30.1.1.1

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

*>i1.1.1.0/24       2.2.2.2                  0    100      0 i

r>i2.2.2.0/24       2.2.2.2                  0    100      0 i

*>i10.1.1.0/24      1.1.1.1                 10    100      0 ?

*>i20.1.1.0/24      2.2.2.2                  0    100      0 i

*> 30.1.1.0/24      0.0.0.0                  0         32768 i

*>i100.1.1.0/24     10.1.1.1                 0    100      0 i

在IGP路由同步到IBGP中之后,IBGP邻居就能够正常通过RR学习到相应的路由信息。

初次了解学习BGP,可能理解或解释的不够准确详细,望各位看官见谅!欢迎一起交流探讨~~~