09-27-2015 04:23 PM - edited 03-05-2019 02:23 AM
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?
Solved! Go to Solution.
09-28-2015 01:25 AM
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
09-27-2015 11:09 PM
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
09-27-2015 11:16 PM
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
09-28-2015 01:25 AM
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
01-10-2018 07:06 AM
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.
10-07-2022 10:00 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide