How to configure BGP AS Path Prepending

(Rene Molenaar) #1

This topic is to discuss the following lesson:

(system) #2

It was a good article but got confusing when you mixed up Jack with John.

(Rene Molenaar) #3

Hi Tony,

Thanks, I just fixed it…the names are now correct.


(system) #4

nice explanation !!!

(Daniel B) #5

Hello Rene,

Thank you for yours articles, great job :wink: . I am beginner in learning of CCNP Routing so sorry for (probably) stupid question. In your articles missing the third attribute (Self-originated). Do you plan write about that? Thank you in advance.


(system) #6

Great example. I do have one question: Are the prepending AS numbers arbitrary or do I have to coordinate this with my ISP. In other words, does it matter if I use random AS prepends are do they have to be reserved just as I reserved my own AS.

(Rene Molenaar) #7

Hi Joshua,

It’s common to prepend your own AS number multiple times, don’t prepend using random AS numbers since to the outside world it appears as someone could reach those AS’es through your AS.


(system) #8

We consider the case of dual ISP connection of a data center to the Internet. We want to receive all traffic via one ISP connection, keeping the other one as backup. How many times should i prepend my ASN#? It seems to me that # prepends > largest ‘natural’ AS pathlength difference from any ww location to my DC. This ensures the prepended pathlength to be always longer than any ‘natural’ pathlength, hence to never take the Internet connection that prepends, unless the other one would fail.
Can anybody give me some figure on this max expected difference in ‘natural’ AS-path lengths to a DC in Western Europe? I expect only a slight difference. Typically two local ISP’s will connect to two (or more) global ISPs, which in turn will reach out to any location worldwide, again via local ISPs at the far end. So two natural, alternate, ‘normal operations’ ASpaths should be quite similar in length. I also understand that, when backup/rerouting situations occur within the Internet, the differences in pathlength can and will increase. I would be curious if with e.g. 10 x prepending the AS, we would be at the safe side to exclude any traffic from entering the DC via the prepended path, as long as both paths are available. BTW, we consider to align the connection preference for ingress (set by AS path prepend) traffic to the egress prefence by applying a different local preference

(system) #9

Hello Rene Sir

This explanation was a mind dynamite. You kept it very simple and I wanted to thank you from bottom of my heart.

I have understood the concept. Thanks and keep writing and motivating people.

God bless you.

(Rene Molenaar) #10

You are very welcome Rounak.

(Rene Molenaar) #11

Hi Jan,

Before I try to answer your question, I guess you want to be dual-homed so that you have a backup path but you want to be sure that your DC is never used as a transit AS?

There’s a simple solution for this, you just need to make sure you don’t advertise anything that you receive from ISP1 to ISP2 and the other way around. If that’s what you are looking for then take a look here:

If that’s not what you want…let me know and I’ll do my best to answer your question.


(Rene Molenaar) #12

Hi Daniel,

I might write a short tutorial on it with an example but it is a simple one. A BGP router will prefer routes that it installed into BGP itself over a route that another router installed in BGP.


(system) #13

Thank you very much, very good article, learnd from you guys, really appreciated!

(jeffrey w) #14

Before applying AS Path prepending to one side the tie breaker was the router ID?

if both routers Jim and John have the Same Loopback0 then isn’t the router ID the same also.

(Rene Molenaar) #15

The list with all BGP’s decisions for selecting the best path is quite long, this Cisco post has a good overview:

It also covers some of the things we normally don’t often talk about. For example, you can see that when everything for an external path that it will prefer the oldest route before using the router ID as a tie-breaker.

The router ID of Jim and John could be the same if the loopback is created before starting the BGP process.

(FABIAN M) #16

Hi Team,

In the Cisco CCNP book, they say to use the inbound route map. I’m confused as to when we should use in our outbound? Can you please clarify?

Lovely site! Will continue to use.


(Rene Molenaar) #17

Hi Fabian,

It depends which BGP attribute you are trying to influence. For AS path prepending, you normally use it to advertise the longer AS path to a remote neighbor. Other attributes like local preference are done on inbound.


(FABIAN M) #18

Thanks Rene. Regarding inbound and outbound, can we say the following?

outbound will affect inbound traffic

inbound will affect outbound traffic


(Rene Molenaar) #19

Hi Fabian,

It’s the other way around :slight_smile:

For example, when you use AS path prepending we configure it outbound. This means that the router on the side will receive the longer AS path…we are influencing them.

When we use a route-map to change the local preference, we do this inbound and it will influence our local AS.


(Shivam K) #20

Hello Rene,

This is the setup I am using to configure BGP multihoming.

AS 100 has two exit points to reach R5 which is hosting a subnet:

My Question is what difference does it make if I advertise directly connected subnets in BGP.

For example:

R1(config-router)#network mask

R2(config-router)#network mask

One thing which I have noticed is if I do not advertise subnet on R1, R2 did not know about it at all so advertising it on R1 did make sense.

Also, what difference will it make if I advertise the same subnet on R3 as well:

R3(config-router)#network mask

Please explain I’ve seen some interesting changes on R5 BGP table by playing with above configurations. Requesting you to please put some light here.

Many Thanks.