Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

assuming I connect to two diff ISP and set them up as redundant connections, one with heavier weight than the other. Is it possible for me to say, any route to some guy in Spain should use the slower link instead of the primary?

Thanks W

share|improve this question
You should mention if you know the network, IP, or AS path to "some guy in Spain". It is much more difficult to do geo-targeting in external routing and this may be a problem better solved up the stack if their network information is not static. – Andy Shinn May 3 '13 at 22:22

Yes, you can use route-maps for that.

Cisco even has a specific example for it:

In short, if the network in Spain would have AS100:

ip as-path access-list 5 permit ^100$ 

route-map setweightin permit 10 
match as-path 5 
set weight 200 

neighbor x.x.x.x route-map setweightin in

Change weight to the weight you want.

Be aware that this only changes the path of the traffic from your router TO the AS in Spain. It does NOT change the path FROM the AS in spain TO you. That is not possible with BGP (except for special cases where you could use BGP communities).

Another thing: If you want traffic to mostly come to you via your primary ISP, you should prepend the AS path to the backup ISP.

This article explains it pretty good:

share|improve this answer

Your best is going to be setting local-pref per-prefix to send your traffic out a specific link. This assumes that you are taking full BGP routing tables from both of your providers. You would do this via a route-map applied inbound for the desired provider.

! First, create a prefix-list to match the traffic you want to send out a non-default ISP
ip prefix-list pfl-target-prefix permit

! create a route-map to match that prefix-list and set the local-pref
route-map rm-bgp-isp-in permit 10
match ip address prefix pfl-target-prefix
set local-preference 150
route-map rm-bgp-isp-in permit 1000

! apply the route-map inbound to your isp
router bgp 1234
neighbor route-map rm-bgp-isp-in in

The benefit of using local-pref over weight is that weight only applies to the local router. You may tell the local router to always take ISP2 for a prefix, but that doesn't mean the rest of your network will too. Local-pref will be propagated to all your iBGP peers, and they will all prefer the route in question. If both providers are on the same edge router, than either local-pref or weight will work fine.

If you are only taking default routes, you'll need to do some shenanigans to re-originate the destination route inside your own network for devices to follow out a particular ISP. The easiest way I can think of to do this is to make a static route that points towards the ISP you want the traffic to go to, then redistribute into your local BGP or IGP.

ip route <target prefix> <wildcard mask> <isp next-hop>
router ospf 1
redistribute static subnets

Again, if both providers are on a single router than redistribute into IGP isn't necessary -- the static will direct your edge router to always use the second ISP as long as the next-hop is reachable.

As another poster mentioned, none of this will impact how the remote prefix reaches you. You'll need to do as-path prepending on your secondary link to try to influence this, but there's still no guarantee it's actually going to come in the path you expect.

Hope this helps.


share|improve this answer

You can do as you ask using BGP, it's not that complex to raise the preference on certain routes. The problem comes in defining what you want to raise. In your example, you want to raise the preference on 'some guy in Spain' to a different link. How are you determining what's in spain? Is that what you really want? Some routes that are in spain are not reachable from the rest of spain directly (think satellite connectivity to remote locations, going to a base station in France). Be very careful with exactly what you're trying to do and make sure you're doing things that affect your performance in the way that you want.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.