How to configure BGP MED Attribute

(Andrew P) #21

The question is whether you have your own AS number or not. If you don’t, you won’t have much control over incoming traffic from ISP A or ISP B. Let’s assume, however, you have been issued an Internet valid BGP Autonomous System number, and you have BGP peerings with both ISP A and ISP B.

You state you want incoming traffic to come from ISP A. In this case, you would use ASPath Pre-pending towards ISP B. This will make your AS Path appear longer (and therefore less desirable) when it is advertised from ISP B.

For outgoing traffic, you have lots of options. If you have only one Cisco router in your company, and it is peered with both ISPs, then you can use Weight. Otherwise, it would be best to use Local Preference, where you set a higher preference for where you want the outgoing traffic to flow (in this case, ISP B).

0 Likes

(Hoan N) #22

Hi Rene

Does MED distributed to other routers within same AS? I have mpls cloud provided by Verizon, Verizon AS 65000,
my office1 in Houston AS 65400 has two routers, router1 and router2, each has a mpls connections to Verizon , router2 is backup and configure MED 10.
my office2 is in Sanfrancisco AS 65401. sometimes I have some unexplained network issue, connectivity from Sanfrancisco to Houston.
I wonder if MED is the issue not being distributed to all Verizon routers in the mpls cloud and cause asymmetric routing, I am thinking changing MED to AS Path Prepend on Houston router2.

thank you

Hoan

0 Likes

(Andrew P) #23

Hi Hoan,
Yes, MED is communicated to iBGP peers. I tested that this morning. Since MED is an optional, non-transitive attribute, however, those iBGP neighbors will not transmit that MED to any EBGP neighbors they may have.

0 Likes

(Shantel - Networklessons.com) split this topic #24

19 posts were merged into an existing topic: How to configure BGP MED Attribute

0 Likes

(Stuart G) #25

Errata:
MED (also called metric) is exchanged between autonomous systems and you can use it to let the other AS know which path they should use to enter your AS. R2 is sending a MED of 200 towards AS 3. R3 is sending a MED of 300 to AS 3. AS 3 will prefer the lower metric and send all traffic for AS 1 through AS 1. <------- R2

0 Likes

(Rene Molenaar) #26

late reply but thanks, it is fixed.

0 Likes

(RAWAZ K) #27

Hello Rene

please , how can in control downstream traffic between two bgp neighbor in Dual Homed bgp topology ? looking forward to your reply .

0 Likes

(RAWAZ K) #28

only two router with two different connections .

0 Likes

(Lazaros Agapides) #29

Hello Rawaz.

If I understand correctly, your scenario involves a dual homed BGP topology and you want to know how to control, or at least influence, inbound traffic, correct?

Because inbound traffic is essentially sent to you, you do not have the ultimate control of how traffic enters your AS. Your ISP may have outbound policies that will always override all of your attempts to influence inbound traffic. However, you do have the option of influencing inbound traffic. There are several ways to do this including:

* Leaking more specific routes
* Using the MED attribute
* AS PATH prepending
* Community/local pref agreement

Remember however, that the ISP has the final word for inbound traffic.

I hope this has been helpful!

Laz

0 Likes

(Nguyen D) #30

Hi
Can you explain between:

  • deterministic-med
  • non-deterministic-med
    Thank!
0 Likes

(Lazaros Agapides) #31

Hello Nguyen

The following excerpt from Cisco documentation very clearly describes the use of these features:

Enabling the bgp deterministic-med command ensures the comparison of the MED variable when choosing routes advertised by different peers in the same autonomous system. Enabling the bgp always-compare-med command ensures the comparison of the MED for paths from neighbors in different autonomous systems. The bgp always-compare-med command is useful when multiple service providers or enterprises agree on a uniform policy for setting MED. Thus, for network X, if Internet Service Provider A (ISP A) sets the MED to 10, and ISP B sets the MED to 20, both ISPs agree that ISP A has the better performing path to X.

This information has come from the following Cisco documentation:


I hope this has been helpful!

Laz

0 Likes

(Brian E) #32

It’s confusing when you say BGP MED aka/or/(Metric). Yes it’s a Metric in the CLI but in Cisco’s docs (at least some of them) it’s Multi Exit Discriminator. IF you search the cisco documentation I liked bellow about MED for Metric it doesn’t find anything. I think you should update your documents to at least mention the Cisco definition I liked. Thanks! I really enjoy your site!

0 Likes

(Lazaros Agapides) #33

Hello Brian

Thanks for bringing this to our attention. I can understand how this can be confusing. According to this Cisco documentation, MED is also known as the external metric of a route, because the lower the MED value, the more preferred a route becomes.

Similarly, the following BGP case studies documentation refers to MED as “the metric attribute” which is also known as “MED”.

The truth is that the original naming of the attribute was Inter AS Metric, and has since been changed to Multi Exit Discriminator, so this is the reason why the term Metric is still sometimes used.

However, to be absolutely correct, the term should be MED. I will let Rene know to clarify the wording to avoid confusion in the future.

I hope this has been helpful!

Laz

0 Likes

(Trust_the P) #34

Absolutely brilliant!

I was going to ask the difference between MED and AS-PATH prepending but it has been answered. One more thing though at the beginning you wrote: “R1 and R3 will both advertise network 1.1.1.0 /24 in BGP. We can use MED to tell AS 1 which path to use to reach this network”. I think it should be AS 2 instead

Thanks.

0 Likes

(Lazaros Agapides) #35

Hello sales2161

Yes, you are correct. I will let Rene know.

Thanks!

Laz

0 Likes