Route selection for BGP

Unanswered Question
Sep 19th, 2007

Location A is connected to Location B,C,D via an MPLS network running BGP

Location A has weighted static routes( metric of 250) for Location B,C,D pointing to a VPN Concentrator for a backup VPN connection.

The static routes are winning selection over the advertised BGP routes.

Why are the statics routes winning over the BGP routes?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3.8 (5 ratings)
Loading.
paul.matthews Wed, 09/19/2007 - 08:06

I am presuming eBGP? If you take the statics out, do the BGP routes appear? What if you add the static routes when the BGP routes ar actually present in the routing table?

Richard Burts Wed, 09/19/2007 - 08:26

Thomas

Is it possible that the static routes are using a mask that is different from what BGP is advertising? That would certainly allow the static routes into the routing table.

Perhaps you could post the output of show ip bgp to show what BGP is advertising and could post the configuration of the static routes from the config file?

HTH

Rick

thomuff Wed, 09/19/2007 - 08:34

Here is a piece of the sh ip bgp

* 10.7.7.0/24 10.10.10.1 0 37054 77002 i

*> 10.5.2.1 0 32768 ?

ip route 10.7.7.0 255.255.255.0 10.5.2.1 250

luqmankondeth Thu, 09/20/2007 - 01:56

I think whats happening here is as follows

a) Before your bgp route comes in, your static is present in the routing table

b) When bgp peer is established and you start exchanging routes, the bgp table is populated with two routes for 10.7.7.0/24

-------> one through bgp with AS path 37054 77002

-------> one redistributed.

c) Now, in the bgp tables (not the router routing tables) the redistributed route is preferred ( http://www.cisco.com/warp/public/459/25.shtml )

d) Since bgp feels the redistributed route is better (c the sign *> before your redistributed route in the bgp table u supplied) it will not introduce this route back into the routing table and hence this doesnt replace the weighted static.

To resolve this, apply a route map into your incoming bgp advertisements and increase its local preference.

thomuff Wed, 09/19/2007 - 08:27

If we take the statics out, the advertised routes immediately enter the routing table. Then, we would put the static routes back in and after a little time, the static routes are back in the routing table. I am thinking it is a time out.

This is for our internal network.

Richard Burts Wed, 09/19/2007 - 09:06

Thomas

I am surprised, but it looks like the static route is getting into the BGP table.

*> 10.5.2.1 0 32768 ?

Are you doing any kind of redistribution with static routes?

Perhaps you could post the output of show ip protocol? This might give us some clue about what is happening.

HTH

Rick

thomuff Wed, 09/19/2007 - 09:32

We are redistrubting static routes

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

IGP synchronization is disabled

Automatic route summarization is disabled

Redistributing: connected, static

Neighbor(s):

Address FiltIn FiltOut DistIn DistOut Weight RouteMap

10.10.10.1

Maximum path: 1

Routing Information Sources:

Gateway Distance Last Update

10.10.10.1 20 01:03:26

Distance: external 20 internal 200 local 200

Kevin Dorrell Wed, 09/19/2007 - 13:29

So is BGP treating these as locally sourced routes and therefore preferable? Strange behaviour if the statics were not in the routing table in the first place.

What might give us a clue is the " ... after a little time ... " I'm trying to work out what that implies.

Kevin Dorrell

Letzebuerg

etienne.basset Thu, 09/20/2007 - 00:11

hello

the static route SHOULD not make it into the bgp table. But if it does for some reason it will stay forever (due to weight 32768).

At the very least you should set weight to 0 (and localpref to 90) when you redistribute this static into bgp.

bye

Etienne

luqmankondeth Thu, 09/20/2007 - 01:57

I think whats happening here is as follows

a) Before your bgp route comes in, your static is present in the routing table

b) When bgp peer is established and you start exchanging routes, the bgp table is populated with two routes for 10.7.7.0/24

-------> one through bgp with AS path 37054 77002

-------> one redistributed.

c) Now, in the bgp tables (not the router routing tables) the redistributed route is preferred ( http://www.cisco.com/warp/public/459/25.shtml )

d) Since bgp feels the redistributed route is better (c the sign *> before your redistributed route in the bgp table u supplied) it will not introduce this route back into the routing table and hence this doesnt replace the weighted static.

To resolve this, apply a route map into your incoming bgp advertisements and increase its local preference.

thomuff Thu, 09/20/2007 - 06:42

I think lugmankondeth is right. I had to power this router off last night to fix a fan issue. As soon as the router powered on, the static routes were present in the routing table. I think everyone is right with the local preference. I will post an update once I give it a try. Probably early next week. Thanks again for all the replies.

thomuff Thu, 09/20/2007 - 07:20

Now, should I use the

bgp default local-preference command to set it

for example,

router bgp 256

network 10.5.2.0 mask 255.255.255.0

network 3.3.3.0 mask 255.255.255.0

neighbor 3.3.3.1 remote-as 300

neighbor 128.213.11.1 remote-as 256

bgp default local-preference 90

thomuff Thu, 09/20/2007 - 07:45

or should set the preference to static routes using a route map

for example

redistribute static setpref

route-map setpref

set local-preference 150

thomuff Thu, 09/20/2007 - 07:50

sorry I meant to say

route-map setpref

set local-preference 90

luqmankondeth Thu, 09/20/2007 - 08:03

Ive never set the local-preference to redistributed routes , personally I would apply the local-prefernce to the route when learned from the ebgp neigbhor.

An interesting twist to this scenario is as follows

a) Your router boots up. You have not applied the weighted static yet.

b) the route is learned via ebgp. SInce this is the only source for the prefix , it will be installed in the routing table

c) If you apply the static now, it will not replace the ebgp learned prefix (higher admin distance) and will not be redistributed into bgp. So, your intended outcome works, ie , static kicks in only when bgp route disappears. But, once your static kicks in, the sequence of events that I narrated before will happen and your routing will break.

Just thought to share this with u....

thomuff Thu, 09/20/2007 - 10:55

That is good to think. I wasn't even thinking about the switching back part.

thomuff Thu, 09/20/2007 - 11:30

How would you that? Would on set it at remote location?

Location A is HQ with the static routes for VPN backup

Location B is the remote location that is the home of the network (for example,10.10.10.0/24) Would I set the local preference At location B or would I set it when it coming into Location A's router?

I understand the end result but I am not sure how to get there.

etienne.basset Thu, 09/20/2007 - 10:39

hello

route-map setpref

set local-preference 90

set weight 0

without setting weight, localpref won't do anything since redistributed routes have by default a weight of 32768 and weight is considered before LOCAL_PREF right? ...

regards

Etienne

luqmankondeth Fri, 09/21/2007 - 02:11

You would set it at location A. Use the route-map supplied by Etienne during redistribution.

so ure config will be

router bgp 1

redistribute static route-map setpref

or modifications of it.

Pavel Bykov Fri, 09/21/2007 - 03:07

Why not block of redistribution of this static route completely?

Like this:

global:

ip prefix-list blockstatic seq 5 permit 10.7.7.0/24

route-map blockstatic deny 10

match ip address prefix-list blockstatic

route-map blockstatic permit 20

bgp:

redistribute static blockstatic

luqmankondeth Fri, 09/21/2007 - 03:24

Probably because thomas wants his internal peers to learn the backup route.

thomuff Fri, 09/21/2007 - 08:09

that is correct. My internal peers need to know the backup route.

Actions

This Discussion