cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4658
Views
4
Helpful
5
Replies

BGP route with lower AD being replaced by static route with higher AD

Ella Bella
Level 1
Level 1

I have a router participating in BGP, and it receives a route from the PE.

router#sh ip route

 

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

Gateway of last resort is 10.200.253.198 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.200.253.198

      10.0.0.0/8 is variably subnetted, 50 subnets, 6 masks

B        10.3.3.0/24 [20/0] via 10.248.232.141, 00:00:05

 

-----

When I add a backup static route with a very high metric with:

Router(config)#ip route 10.3.3.0 255.255.255.0 10.248.200.1 252

 

The routing table doesnt change at all initially. After an indeterminate amount of time, the BGP route is replaced with the static route:

S        10.3.3.0/24 [252/0] via 10.248.200.1

 

Which of course affects the routing.
As soon as I remove the static route, the BGP one populates the routing table immediately.

 

So why is this so? Shouldnt the BGP with an AD of 20 trump the static route with an AD of 252?

1 Accepted Solution

Accepted Solutions

  7545 64516
    10.248.232.141 from 10.248.232.141 (10.20.22.13)
      Origin IGP, localpref 100, valid, external
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  Local
    10.248.232.141 from 0.0.0.0 (10.200.253.194)
      Origin incomplete, metric 0, localpref 100, weight 32768, valid, sourced,
      best
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0x0

 

OK, what most probably happens it this: Once the BGP-learned route disapears from the routing-table, the static backup route is installed and redistributed into BGP (because it's in the local routing-table now.)

When the same route now is (re-)learned from the BGP peer again (after a link-flap e.g.), the local route has still preference because it's (default) weight is higher. In order to solve this, the (local) weight for the BGP-learned route need to be higher than the redistributed route's weight.

Just let us know if you need assistance on that.

BGP Case Studies: http://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/26634-bgp-toc.html#weight

 

HTH

Rolf

View solution in original post

5 Replies 5

Rolf Fischer
Level 9
Level 9

Hi,

do you redistribute that static route to 10.3.3/24 into BGP?

If so, it may have preference over the eBGP route in the BGP table after a flap and remain in the routing table (for instance because of its weight).

When the static route replaces the eBGP route the next time, could you share the output of 'show ip bgp 10.3.3.0 255.255.255.0' here?

HTH

Rolf

Hi Rolf,

Yes, redistributing static into BGP. The 10.3.3.0 no longer has a static entry, however I have another route on there in a similar situation (I have the static next-hop as the same GW as the BGP route next-hop - just for testing).

 

Router#sh ip bgp vpnv4 vrf RRI 10.3.23.0 255.255.255.0
BGP routing table entry for 64517:308:10.3.23.0/24, version 8247
Paths: (2 available, best #2, table RRI)
  Advertised to update-groups:
     21
  Refresh Epoch 1
  7545 64516
    10.248.232.141 from 10.248.232.141 (10.20.22.13)
      Origin IGP, localpref 100, valid, external
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  Local
    10.248.232.141 from 0.0.0.0 (10.200.253.194)
      Origin incomplete, metric 0, localpref 100, weight 32768, valid, sourced, best
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0x0

 

  7545 64516
    10.248.232.141 from 10.248.232.141 (10.20.22.13)
      Origin IGP, localpref 100, valid, external
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  Local
    10.248.232.141 from 0.0.0.0 (10.200.253.194)
      Origin incomplete, metric 0, localpref 100, weight 32768, valid, sourced,
      best
      Extended Community: RT:64517:308
      rx pathid: 0, tx pathid: 0x0

 

OK, what most probably happens it this: Once the BGP-learned route disapears from the routing-table, the static backup route is installed and redistributed into BGP (because it's in the local routing-table now.)

When the same route now is (re-)learned from the BGP peer again (after a link-flap e.g.), the local route has still preference because it's (default) weight is higher. In order to solve this, the (local) weight for the BGP-learned route need to be higher than the redistributed route's weight.

Just let us know if you need assistance on that.

BGP Case Studies: http://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/26634-bgp-toc.html#weight

 

HTH

Rolf

I can understand the answer but I have my doubts if the process is right. The first criterion for installing a route into routing table is the prefix length and the next one is AD. So in this case you have these regarding the same exact prefix:

 

- One static route with AD 252

- One BGP route width AD 20

 

I cannot find any reason that the first one is selected when both routes exist in the database. The one with lower AD should be preferred.

I agree; what other prefix parameters would the FIB use to choose a route? Admin distance should be the only thing considered between Static and BGP. Weight should only be a factor in which path BGP offers to the FIB. 

Review Cisco Networking for a $25 gift card