bgp -1 ebgp邻居,下一条属性, 路由黑洞, BGP同步

 

 

 需求1: 如图建立ebgp,和ibgp邻居。 

   ebgp 邻居建立: 1 使用物理接口

                2  使用换回口, 同时增加到达对方lo 口的静态路由 ,配置ebgp多跳

   ibgp 邻居建立: 使用换回口建立, igp 全网互通, 

 

需求2: r4 上通过bgp 通告 10.1.44.4/32  , 使r2 可以达到

   r4 建立lo 1  10.1.44.4 /32 ,  bgp中network 

      1  r4,r1 ,r1  bgp 路由如下:   

[R4-bgp]disp bgp rou

BGP Local router ID is 10.0.4.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete


Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*> 10.0.44.4/32        0.0.0.0           0                       0    i      (r4 始发 network的)

<R1>disp bgp rou

BGP Local router ID is 10.0.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete


Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*> 10.0.44.4/32 10.0.4.4 0 0 64513i             (r1 上看出 as path  64513 ,i   , 下一条10.0.4.4  可达, 可用最佳)

    

<R2>disp bgp rou

BGP Local router ID is 10.0.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete


Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

i 10.0.44.4/32 10.0.4.4 0 100 0 64513i        ( r2 上看到 不可用)
*>i 10.1.5.0/24 10.0.3.3 0 100 0 64514i

<R2>disp ip rou 10.0.4.4    

没有任何内容,可以看出没有到达10.0.4.4 的 路由。
bgp路由的下一跳一定要通过igp迭代可以到达 ,否则不优,不可用也不会传给其他peer

 

解决:

  •  方案1:  r1 把10.0.44.4 引入IGP  
  •     方案2: r2 配置到10.0.4.4 的静态路由,  
  •               r1 通过bgp 把10.0.4.4 传给r2  
                  r2 上要去往10.0.44.4 先找 10.0.4.4 

    <R2>disp bgp rou

    BGP Local router ID is 10.0.2.2
    Status codes: * - valid, > - best, d - damped,
    h - history, i - internal, s - suppressed, S - Stale
    Origin : i - IGP, e - EGP, ? - incomplete


    Total Number of Routes: 3
    Network NextHop MED LocPrf PrefVal Path/Ogn

    *>i 10.0.4.4/32 10.0.1.1 0 100 0 i
    *>i 10.0.44.4/32 10.0.4.4 0 100 0 64513i
    *>i 10.1.5.0/24 10.0.3.3 0 100 0 64514i

    要去往10.0.4.4  ,通过10.0.1.1  ( ibgp 方案3配置的)

    要去往10.10.1.1, 通过r1-r2 之间的igp 可以到达

  •     方案4 :  r1 配置 下一条属性
    [R1-bgp]peer 10.0.2.2 next-hop-local

     在r1  对r2 上配置  下一跳为自己

<R2>disp bgp rou

BGP Local router ID is 10.0.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete


Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn

*>i 10.0.44.4/32 10.0.1.1 0 100 0 64513i

       如此,r1 从ebgp  r4学的 路由,下一条设置为自己于r2 建立邻居的地址  ,r2必定可用到达。


 

BGP 和igp 同步:

   发生在从igp邻居学到bgp路由,在向ebgp发送bgp路由时

   只有当bgp路由 在igp表也有时,这条bgp路由才优,所以才会传递给ebgp邻居

 

    同步开启:  R1 只有在IGP 表存在5.5.5.5/32 路由时, 才会传递给R3

    华为默认关闭,且不能开启 

  cisco 可以开启  

  1 开启同步  

r1#sh run | sec route
router bgp 10
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 10.0.13.3 remote-as 20
neighbor 10.0.15.5 remote-as 10
!
address-family ipv4
synchronization
neighbor 10.0.13.3 activate
neighbor 10.0.15.5 activate

r1#show bgp ipv4 unicast
BGP table version is 28, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
* i 5.5.5.5/32 10.0.15.5 0 100 0 ?

    2   R1配置静态路由5.5.5.5/32 指向 R5

r1#sh run | in ip route
ip route 5.5.5.5 255.255.255.255 10.0.15.5

 

    3  5.5.5.5 已经优, 可以传递给R3

r1#sh bgp ipv4 unicast
BGP table version is 29, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
r>i 5.5.5.5/32 10.0.15.5 0 100 0 ?

r3#show bgp ipv4 unicast
BGP table version is 45, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 5.5.5.5/32 10.0.13.1 0 10 ?

    4 但是, R3 ping 不通5.5.5.5    ,因为R1 没有 10.0.13.0/24  路由,无法回包。。。

r1 宣告直连或  neibour r5 下一跳自己

r1(config-router-af)#do sh run | s rou
router bgp 10
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 10.0.13.3 remote-as 20
neighbor 10.0.15.5 remote-as 10
!
address-family ipv4
synchronization
network 10.0.13.0    //无效,why ?
network 10.0.13.0 mask 255.255.255.0    // 有效

 

r1(config-router-af)#do sh bgp ipv4 un
BGP table version is 30, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
r>i 5.5.5.5/32 10.0.15.5 0 100 0 ?
*> 10.0.13.0/24 0.0.0.0 0 32768 i

 

r5#sh ip rou bgp
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
B 10.0.13.0/24 [200/0] via 10.0.15.1, 00:02:31

 

r3#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

posted @ 2020-10-26 16:50  abel2020  阅读(418)  评论(0编辑  收藏  举报