How to configure BGP MED Attribute


(Rene Molenaar) #1

This topic is to discuss the following lesson:


(system) #2

please check your article. the example you have given and configuration you did.


(Rene Molenaar) #3

Thanks Husain, I just fixed the names so that the pictures match the configurations.


(system) #4

why are u running this command and please also tell me what are med and local preference.

neighbor 192.168.23.2 route-map MED out

i think it should be

neighbor 192.168.23.2 route-map MED in

please clear it


(Rene Molenaar) #5

MED is used to tell your neighbor AS what link they should use to send traffic to your AS. Local preference is used to select an exit path for your AS.

The route-map is correct as we are sending the metric to our neighbor AS. For local preference you’ll need an inbound route-map.


(Nicholas Russo) #6

Another fun fact: Although MED is a discretionary non-transitive attribute, it IS transitive across confederation ASes.


(Klaus E) #7

Rene.

Thanks for this great article.

When you said “AS 3 will prefer the lower metric and send all traffic for AS 1 through AS 1” wouldn’t be right to say “AS 3 will prefer the lower metric and send all traffic for AS 1 through Router Julian”. ?

Regards and keep doing well.


(system) #8

First of Congratulation Rene…for ur CCIE Number… U deserve it. The lab u post & the way u write article in most simple form is simply amazing. Why don’t u start writing books for CCIE R&S TS… I would love to hv one in my collection. Wish u all the success. I m a fan of ur blog who is chasing the dream of CCIE R&S.


(Mohammad Taslim M) #9

Hi Rene,

It’s a very nice explanation.
Any way , can you explain the topic on BGP Multipath Load Balancing and ECMP ?

Thank you

BR
Taslim


(Nhan D) #10

Hi Rene,

Is MED optional non-transitive? If it is non-transitive can we pass it onto other AS?

In this case, we can see Jack router receives the MED value from another AS.

Thanks,

Nhan.

 


(Rene Molenaar) #11

Hi Nhan,

MED is optional non-transitive yes. This means that it will be advertised from one AS to it’s neighbor AS but not further. For example:

AS1-AS2-AS3

AS1 can advertise the MED for a prefix to AS2 but AS2 will not advertise this to AS3.

Rene


(shaun y) #12

hi great lesson but I have 1 question I understand everything you’ve said but if you where to use a /32 loopback as the update source for 2 ebgp neighbour how would you be able to tell your isp the lower M.E.D. for the faster link if you neighbour command was the loopback for you isp and not an interface


(Rene Molenaar) #13

Hi Shaun,

When you use a loopback as the source for eBGP then you will need a static route so that both eBGP routers know how to reach each other’s loopback interface. There’s no point in advertising this prefix once the eBGP neighbor adjacency is up.

For everything else that you advertise, you can add a MED value. So for example when you advertise prefix 123.123.123.0/24 or something, you can set a high MED for interface 1 and a low MED for interface 2 to tell the remote ISP how to reach this network.

Rene


(shaun y) #14

thanks it so hard to get any information when your studying for a ccnp all by yourself and I’m not in an i.t. job yet keep up the good work


(kandhla c) #15

Hi Rene

Thank you for writing this.
I had a question though. We use AS path Prepending as well to influence traffic entering our AS. In what scenario i would use either of them ? Or is it upon engineers choice to choose either?

Thank you
Kandhla


(Rene Molenaar) #16

Hi Kandhla,

It’s up to the network engineers / ISPs but there is one key difference between AS path prepending and MED:

  • When you use AS path prepending, it will show up at your neighbor AS and all other ASes behind them.
  • When you use MED, it will show up at your neighbor but NOT at any AS behind them.

Rene


(Venus D) #17

Great explanation and difference on MED and AS PAth Prepending! Thanks Rene


(William K) #18

So how is MED different from AS Path Prepend? MED only affects your single neighbor AS where AS PATH prepend would be sent to all AS’s?

Also I thought MED standing for Multi Exist Discriminator… not sure where I got that.


(Andrew P) #19

MED = Multi-Exit Discriminator

AS Path pre-pending and MED are both ways in which you are trying to influence inbound traffic into your AS–these are really the only two tools available for you for this purpose. So you are right in the sense that they serve the same purpose, but they do so via different BGP attributes (obviously). In reality, almost no-one uses MED, for two reasons: 1) As you point out, MED will only be learned by your directly connected neighboring AS, so it won’t do much for influencing traffic beyond that. AS-Path prepending, however, has a global reach (although if you pre-pend with too long a path, you might get filtered). 2) MED is pretty far down on the BGP best path selection criteria, and BGP rarely gets to the point where MED would be a tie breaker.

For these reasons, everyone does AS-Path prepending for influencing inbound traffic flow.


(Ajay Krishna M) #20

Hi Rene/Andrew,

I have one question

I have two ISP A and B with two different provide and AS. i need incoming traffic should come from ISP A and outgoing traffic should go on ISP B.

so which attributes i need to use for this.

Regards,
Ajay