BGP

Unanswered Question
Apr 29th, 2009

guys we have one switch and two routers (WAN) going to same service provider.......now i have config HSRP on the ethernet and i want that router A shd be primary and if it fails router B shd take over....now its has been done by HSRP config......now how i will influence traffic to come through router A rather then router B....thanks

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (3 ratings)
Loading.
c.captari Wed, 04/29/2009 - 22:11

Your traffic will go to your active HSRP router every time.

You have to make sure that router A and router B both have EBGP sessions with your provider and that they have an IBGP session as well.

If router A EBGP fails, even if traffic comes first to router A (as you have the active HSRP on router A), router A will learn via IBGP that router B has access to the external world and will route the packet to router B

so to summarize:

- make sure you have EBGP and IBGP sessions on both router A and router B

Also as a nice addition, though not necessary for your redundancy to work, HSRP tracking can help you out to switch the active gateway in case the outside interface fails. you may want to have a look at that

if you want a more complex setup you can have a look at PBR Support for Multiple Tracking Options

http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gtpbrtrk.html

Basically with this you can modify you active HSRP gateway by checking whether an IP in the internet is reachable from your router. If yes, HSRP active, if not, HSRP goes in standby. I'd stick with the first setup if you don't want to complicate things.

In terms of BGP setup if that was your question, if you have both uplinks to the same provider as you mentioned you can use MED (multiple exit discriminator) to influence the incoming primary path and local preference to influence the outgoing path.

MED = metric (lower is better) Set it lower on router A as opposed to router B (by default med is 0, so you can go to router B and set med to 10 for example which makes it worse than A. )

LOCAL PREFERENCE (higher is better)= Set it higher on router A as opposed to Router B. (by default LP is 100, go to Router A and set it to 110)

Giuseppe Larosa Thu, 04/30/2009 - 00:53

Hello Khan,

for eBGP

use MED setting metric on both router A and routerB with routerA metric value lower.

route-map RAtoisp permit 10

set metric 50

router bgp xx

neigh isp-addr route-map RAtoisp out

route-map RBtoisp permit 10

set metric 100

router bgp xx

neigh isp-addr route-map RBtoisp out

notice about MED: it can even be missing as usually when missing is preferred to any value.

you may want to add also AS path prepending on RB as an attempt to influence return path

Hope to help

Giuseppe

c.captari Thu, 04/30/2009 - 02:20

Giuseppe. MED influences the return path. As long as ISP allows you to set up med without resetting that value you got yourself a setup for return path. No need for AS Path prepending if you already did MED

Just a note for MED: it is usually used when you have exit points to the same ISP, not usually used when you ebgp with multiple ISPs. In the given case MED will work just fine (once again for return path).

Use local pref for influencing the outbound path

Giuseppe Larosa Thu, 04/30/2009 - 03:46

Hello Claudiu,

you're absolutely right.

I was in a hurry to go out to come to office and during travel I realized I had given misleading information.

Sorry for that.

Best Regards

Giuseppe

The_guroo_2 Thu, 04/30/2009 - 16:46

Thanks guys for your help Giuseppe and Claudiu.....i guess we guys like me are very lucky that we have guru's like you. Thanks again now guys one more thing i am bit confuse abt the BGP static route i will try to explain it some time we put a static route to null 0....in bgp why is that i mean what is the reason can you please explain in plain language with scenario....thanks again

c.captari Thu, 04/30/2009 - 17:44

You need to understand the difference between BGP and other IGP routing protocols like OSPF, EIGRP, RIP etc

You know how in an IGP for example if you want to advertise a network you need to have that network attached to an interface and you can pretty much go into router rip and do network x.y.z.w and that's it.

BGP is different. BGP will not advertise a route if it can't find an exact match into the routing table (bear that in mind as it is very important. BGP cares about the routing table and it does not necessarily need an active interface holding that subnet, like IGP does). So say you want to advertise 10.1.2.0 255.255.255.224 (10.1.2.0/27).

So knowing that a prerequisite for advertising 10.1.2.0 outside is to have that exact entry in the routing table you are basically stuck with 2 options: either you already have it in the routing table , which means you can easily go into router bgp and do a: network 10.1.2.0 mask 255.255.255.224

or second option , if you don't have that into the routing table, you have to put it into the routing table in order to be able to advertise it:

so you do ip route 10.1.2.0 255.255.255.224 Null0 (Null0 is a virtual IOS interface pointing to nothing, to yourself)

now that you are meeting your requirement , you can go into router bgp and advertise that network

with : network 10.1.2.0 mask 255.255.255.224

http://en.wikipedia.org/wiki/Nullroute

What you need to understand is that at the end of the day your IGP has to provide a way to reach that route which you artificially put up in your routing table as pointing to Null0.

So whether it's a default route , a summarized block to that network pointing to another hop or whatever else, your router needs to know about a path to that network. Otherwise your traffic will come from outside world and it's just going to get blackholed into Null0 not knowing what path it should take next

anilraahi Thu, 04/30/2009 - 19:47

hi captari , y r u recomanding to use MED, which as lowest priority.

inbound traffic can well be influenced with ASPATH prepending.

Correct me if i am wrong . :)

regards

Raahi

c.captari Thu, 04/30/2009 - 20:40

Hi,

For one simple and obvious reason!

If you have exit points to the same ISP (technically to the same AS) it is very clear that all the routes that you receive from the outside world and push out will have the same AS length, no matter which link from the ISP they come in or exit out, isn't it?

So. Considering the BGP path selection algorithm

1. weight

2. local pref

3. origin code

4. prefer shortest AS-PATH

5. prefer lowest origin code

6. prefer lowest MED

[..... others.....]

now think about point 4. Whatever will get in and get out will have the same length. So what comes into play next : origin code , which doesn't matter as long as you don't tinker that. so you get down to MED! which comes into play by default and is the ONE who will influence your routing paths in this case (remember! won't work when peering with different ISPs in different AS as this indeed may render different lenghts in AS paths for the same prefix)

Of course, this can be done with AS path prepending as well and it will work just as beautiful, but if you understand the metrics of BGP there is no obvious reason to do AS PATH prepending when peering to the same AS number multiple times.

Definitely MED will help you out in this case.

Otherwise i think it's a question of personal preference.

I like to keep things consistent to Cisco documentation which does recommend using MED when you have uplinks to one single provider

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094934.shtml

Actions

This Discussion