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

Prefer BGP over Static Route / Redistributing BGP/MPLS

bgp-static.png

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?

EDIT:

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 192.168.0.0/24 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

13 comments
81% Upvoted
What are your thoughts? Log in or Sign uplog insign up
level 1

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.

level 1

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

level 2
Original Poster1 point · 2 months 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

level 3

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?

level 4
Original Poster1 point · 2 months 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

level 5

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.

level 6
Original Poster1 point · 2 months ago

could you elaborate please?

level 5
2 points · 2 months ago · edited 2 months 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"

level 1

Try using a better image host.

level 2
Original Poster1 point · 2 months ago

whats wrong with postimg.cc?

level 3

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

level 3
Jack of no trade, but I'm pretending OK3 points · 2 months ago
level 3
To some, the phone is a weapon2 points · 2 months ago

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

Community Details

131k

Subscribers

991

Online

###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
1.
Rule #1: No Home Networking.
2.
Rule #2: No Certification Brain Dumps / Cheating.
3.
Rule #3: No BlogSpam / Traffic re-direction.
4.
Rule #4: No Low Quality Posts.
5.
Rule #5: No Early Career Advice.
6.
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.