I have Cisco router with 2 bgp's sessions from 2 isp's and want to separate my networks for example to go trough first ISP and to go trough the second ISP, but to have the option if one of them goes down the traffic to be rerouted.

Is there a way to do this.

Regards, Damjan

1 Answer 1


I assume from your question you only really want to control inbound traffic to your 2 networks from the ISPs.

You need to alter the routing decision for upstream networks, 2 ways you could do thist with 2 independent ISPs are:

  • increase the AS path when advertising the network to the provider you want to act as a backup (AS path prepending)
  • by advertising multiple routes that are more specific than the original aggregate routes (more specific routes)

With AS path prepending you literally insert your AS into the AS path multiple times to artificially increase the length. To preprend on a cisco use a route map such as below:

route-map PREPEND permit 10
   match ip address prefix-list PREPREND_ROUTES
   set as-path prepend 65001 65001 65001 65001

Using your example, you might prepend when advertising to ISP2, and prepend when advertising to ISP1. This would cause traffic for to arrive via ISP2 in normal circumstances, with the reverse being true for

To use more specific routes, you take for example a /23 route and advertise the 2 inner /24 routes instead, making these routes more specific and preferred over any larger (less specific) aggregate routes. Using your example networks:

ISP1 - advertise,,
ISP2 - advertise,

The above would cause traffic for to come via ISP1 in normal circumstances, and to come via ISP2.

The more-specific routes option is more reliable if you upstream providers will allow you to advertise with the more specific prefix length to them, some providers may block all routes with a prefix length longer than 24 for example. The reason it is more reliable is that it is possible that using AS path prepending that some networks will still have a shorter path via the prepended route due to a real shorter path of networks.

  • Thank you C3st7n for you answer I'm still struggling to make this work. Apr 27, 2017 at 8:48
  • So far I have the following configuration: ip prefix-list 90_out seq 10 permit ip prefix-list 90_out seq 20 permit ip prefix-list 90_out seq 30 deny ! ip prefix-list 80_out seq 10 permit ip prefix-list 80_out seq 20 permit ip prefix-list 80_out seq 30 deny route-map 90_out permit 10 match ip address prefix-list 90_out route-map 80_out permit 10 match ip address prefix-list 80_out Just note that and in the real scenario are in same /23 subnet. Apr 28, 2017 at 10:34
  • It's hard to parse out from the comment and the example addresses make this more confusing because they would not overlap in real life, but I think what you have is correct, but obviously the /23 and /24 routes need to exist in some way before they can match the prefix list. Can you give anymore information about what is or isn't happening?
    – c3st7n
    May 8, 2017 at 8:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .