MED (or metric) is the sixth BGP attribute:
- MED can be used to advertise to your neighbors how they should enter your AS.
- MED is exchanged between autonomous systems.
- The lowest MED is the preferred path.
- MED is propagated to all routers within the neighbor AS but not passed along any other autonomous systems.
Let’s look at an example:
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 R2. Let me show you how to configure this on a Cisco router:
Above we have two autonomous systems. R1 and R3 will both advertise network 1.1.1.0 /24 in BGP. We can use MED to tell AS 2 which path to use to reach this network.
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
R3(config)#router bgp 1
R3(config-router)#neighbor 192.168.23.2 remote-as 2
R3(config-router)#network 1.1.1.0 mask 255.255.255.0
R2(config)#router bgp 2
R2(config-router)#neighbor 192.168.12.1 remote-as 1
R2(config-router)#neighbor 192.168.23.3 remote-as 1
This is the BGP configuration, nothing special so far.
R2#show ip bgp
BGP table version is 2, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.0/24 192.168.23.3 0 0 1 i
*> 192.168.12.1 0 0 1 i
You have seen the example above before. R2 prefers the path through 192.168.12.1. Note that the default metric (MED) is 0. Let’s play with the MED now:
Hi Kandhla,
It’s up to the network engineers / ISPs but there is one key difference between AS path prepending and MED:
Rene
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
... Continue reading in our forumHello 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
... Continue reading in our forum* Using the MED
Hello Nguyen
The following excerpt from Cisco documentation very clearly describes the use of these features:
... Continue reading in our forumHello 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.
https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13759-37.html
Similarly, the following BGP case studies documentation refers to MED as “the metric attribute” which is also known as “MED”.
https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/26634-bgp-toc.ht
... Continue reading in our forum