Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts

Prefer BGP over Static Route / Redistributing BGP/MPLS


Please excuse my drawing skills. Looking for some advice on how to best achieve this solution. Client has 2 routes into our core (the bgp route is going live soon, currently the static route is active), and they want the BGP route to be primary and the statics to be a failback incase they lose the bgp route to us.

How can i possibly achieve this?

The issue when ive tried to lab this is that the statics have a lower AD and take preference on the attached router and this is then propogated throughout our core.

The router attached to the BGP route learns both routes, but prefers going up to the router in the top left due to the AS path attribute being shorter(the path is just itself). As the ebgp route is not in the routing table it also doesnt get advertised to its internal peers.

I've tried amending the preference of the static routes to be higher than bgp(170, this is Juniper), but im getting inconsistent results depending on what order the routes go up/down.

All i can think of so far is to change the statics to a default route (this is within a vrf, so only traffic within this routing instance will be defaulted out to this client)

Anyone able to offer some wisdom?


Found a solution that works. On the router with statics amend the preference to be higher than iBGP:

#set routing-instances TEST routing-options static route preference 200

On the eBGP attached router amend the BGP preference to be lower than iBGP:

set routing-instances TEST protocols bgp group TEST-bgp preference 4

Routes now flip over during failover as expected

80% Upvoted
What are your thoughts? Log in or Sign uplog insign up
2 points · 4 days ago

On Junos you can specify the preference on a per-route basis. This way, you don't have to affect the preference of all static routes or all BGP routes.

5 points · 5 days ago

Make them run BGP on the router that you want to use the static on. Anything else is an unmanagable hack.

Original Poster1 point · 5 days ago

Even then how would I prefer what one over the other? I looked at local-preference but I can’t see how that would work as it’s within a vrf but the ibgp neighbours are configured within the global configuration

3 points · 5 days ago

So the statics are within their own VRF that isn't learning any bgp routes? Can't you just redistribute the bgp routes into the VRF and lower the preference of the statics to 200?

Original Poster1 point · 5 days ago

no, bgp and statics are within the same vrf. For Juniper you need something like below for local-preference:

[edit protocols bgp group internal]

user@R3# set local-preference 300

That would affect ALL clients as it would be configured in the global config

For Clarity:

the iBGP is configured globally, the eBGP is configured within a routing-instance

3 points · 5 days ago

You can set localpref with a routemap for a specific peer or prefix, or you could use MED to influence outbound. There's a few ways to skin this cat.

Original Poster1 point · 5 days ago

could you elaborate please?

2 points · 4 days ago · edited 4 days ago

Localpref only affects decisionmaking between eBGP learned routes, it's not the AD of the route.

If you want to set the AD of routes installed via BGP you need to do that via import policy and set the preference (not local-preference, which is a BGP attribute) for the prefix. Also not to be confused with metric which either sets the outgoing MED or spoofs the incoming MED if for some reason setting local-preference (which is derived from MED if available) on an inbound prefix isn't desired (which is silly because it's effectively two ways to do the same thing, unless someone can correct me on why they're functionally different)

Don't know why Juniper used "preference" instead of something more precise like "admin-distance"

Try using a better image host.

Original Poster1 point · 5 days ago

whats wrong with

I got popups and a message that it wants to send me notifications. Imgur doesn't do that

Jack of no trade, but I'm pretending OK
3 points · 4 days ago
To some, the phone is a weapon
2 points · 4 days ago

As much as I hate Imgur, its not nearly as annoying as PostimgDOTcc is.

Community Details





###Enterprise Networking Routers, switches and firewalls. Network blogs, news and network management articles. Cisco, Juniper, Brocade and more all welcome.

Create Post
r/networking Rules
Rule #1: No Home Networking.
Rule #2: No Certification Brain Dumps / Cheating.
Rule #3: No BlogSpam / Traffic re-direction.
Rule #4: No Low Quality Posts.
Rule #5: No Early Career Advice.
Rule #6: Educational Questions must show effort.
Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.