BGP outbound load balancing with 3 upstreams

Unanswered Question
Sep 19th, 2007

I have a router "Router_A" advertising "prefix_A" to ISP A and Router_B advertising prefix_B to ISP B . Both Router A and B are connected via EBGP . Router A has also one more BGP session connecting to Saudi Local internet Exchange . I'm receiving default route from ISP_A and ISP_B .

I want to set the outgoing for Prefix_A to go thru ISP A and Prefix_B to go thru ISP B . The local internet exchange traffic shud be routed normally


route-map outgoing1 permit 5

match as-path 2

route-map outgoing1 permit 10

match ip address prefix-list Prefix_A

set ip next-hop ISP_A ISP_B


route-map outgoing1 permit 20

match ip address prefix-list Prefix_B

set ip next-hop ISP_B ISP_A


"route-map outgoing1 permit 5" is for matching the Local internet exchange traffic , i want to catch this traffic before it gets to the other sequences of the route map and it shud be routed according to my bgp routing table

ip as-path access-list 2 permit ^65000

But after applying this route-map on my router interface i can only see matches for first statement (route-map outgoing1 permit 5 ) ...I'm receiving about 500 Prefixes from Internet Exchange and it's not possible for me to match all this by using an ACL . Please suggest me what shud i do to achieve my task

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
ivillegas Tue, 09/25/2007 - 12:28

The Border Gateway Protocol (BGP) policy accounting (PA) feature allows you to account for IP traffic differentially by assigning counters based on community list, AS number, and/or AS_PATH on a per input interface basis.

Haris P Tue, 09/25/2007 - 13:12

Can you show me how it's going to help in my case .



battyjohn Wed, 09/26/2007 - 02:13


What are you actually trying to filter here? If I look at what you want, Router A is connected to ISP A, and an exchange. Router B is connected to ISP B. Therefore Router A and B must be connected via IBGP?

Also I presume you have a filter list of networks you want to advertise from Router A to ISP A (and B to ISP B), therefore I would expect you to just apply that prefix-list/filter to ISP A only. For the Saudi Connection I would also presume that you want to recive all the routes, but not propagate them to the ISP's? In which case you may only require a filter list to your ISP A and B to prevent thoose routes going up and to prevent you acting as a transit AS between ISP A and B.

Also you may want to restrict what routes you receive from the ISP's to just default routes?

If you want to make sure that Router A only uses ISP A for certain routes, and indeed B for others, you might want route maps setting local preference or weight.

Hard to tell without some more configuration displayed.

ariesc_33 Wed, 09/26/2007 - 02:30

i agree with battyjohn. But if you want redundancy, set a higher local pref for prefixA on Router A and higher local pref for prefixB on Router B.

Haris P Wed, 09/26/2007 - 04:09

My Problem is about the outgoing traffic only . Now As Arisec told I'm putting higher local prefernce for ISP B and now all my outgoing is through ISP B . But I want to change the way of outgoing traffic

A is been advertise via upstream A and network B via upstream B, now I want that network A will go out upstream A and network B will go out upstream B, and it's only possible with PBR and the problem is that i can only apply a PBR on inside network of Router A and i want to filter out the local internet exchange traffic from this PBR and need to go according to the routing table .... But I can't define a route-map to match AS-path , only IP access-lists and packet lenght will be matching in a normal PBR

battyjohn Wed, 09/26/2007 - 04:21

Rather than play about with BGP then, in this case you need to isolate what internal networks you want to go via ISP A as an exit point and manipulate your IGP (OSPF, EIGRP, etc) to use ISP A as the exit for that traffic, and vice versa for ISP B.

I don't think manipulating BGP in any form will give you what to achieve easily.

ariesc_33 Wed, 09/26/2007 - 05:40

im not sure but this may be applicable

for ISP-A

access-list 10 permit

route-map Prefix-A

match ip address 10

set local-preference 200

! default local preference for prefix B is 100

router bgp 1

neighbor ISP-A route-map Prefix-A

for ISP-B

access-list 20 permit

route-map Prefix-B

match ip address 20

set local-preference 200

! default local preference for prefix A is 100

router bgp 2

neighbor ISP-B route-map Prefix-B

battyjohn Wed, 09/26/2007 - 06:28

Check this link:

It gives you an idea of what you need to do, basically on each of your two routers set the weight so it prefers the correct ISP, then create your access-lists for the two separate sets of traffic, and create the Policy based route map, setting the next hops you wish to use for each access-list. Apply this to your incoming interfaces to router A and B (and by that I mean internal interfaces not the ISP ones), and all should be good!

Let us know how you get on :-)

Haris P Wed, 09/26/2007 - 09:19

Dear Ariesc,

I think will not work this way , under bgp we have to put route-map as either out /in . For example , if the route-map we apply on Router_A as out which will set higher local prefer for Prefix_A and which will only influence the traffic coming outside to prefer Router_A for Prefix_A . If we apply this route-map as in for Router_A it is not going to do anything,in normal cases we are applying this type of route-map as "in" when we are we are receiving similar prefixes from upstream and to prefer one ISP


This Discussion