cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
629
Views
2
Helpful
8
Replies

BGP Policy using MED

verma-rohit
Level 1
Level 1

Hi, Why is BGP MEd always applied outbound ? Consier a topolgy, 

Site 1  ------------link1-----------Site 2

         ------------link 2 --------------

In real world for site 1 to chose link 1 over link 2 using med, site 2 would  construct policy using med, configuring lower med on link1 than link 2 and apply it outbound. 
I am wondering why can't the same be applied inbound ?
RTR1 : 

route-map MED_10 per 10

set metric 10 

and apply this route-map inbound on rtr1. Likewise configure higher med on rtr2.

 

1 Accepted Solution

Accepted Solutions

Hi M02@rt37 ,

The MED can actually be set inbound or outbound. So let's say you want site1 to prefer one link over the other, you could set the MED outbound on site2 for updates sent to site1 or set the MED inbound on site1 for updates received from site2. Both would work.

I would agree that setting the MED outbound is more commonly seen though.

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

View solution in original post

8 Replies 8

M02@rt37
VIP
VIP

Hello @verma-rohit 

MED attribute is typically applied outbound from the perspective of the router sending the update. This is because the MED is used to influence the exit point of traffic leaving the AS. It's a way for one AS to communicate to a neighboring AS about its preferred exit point for traffic destined to the neighboring AS.

In your scenario, where site 1 want to influence the outbound traffic to prefer Link 1 over Link 2, site 2 would indeed configure the MED attribute and apply it outbound toward Site 1. This means that site 2 is informing site 1 about its preferred exit point for trafic coming from site 1.

Now, let's consider the inbound direction on RTR1. When RTR1 receives BGP updates from site 2, the MED value is already set by site 2. If you were to apply a route-map inbound on RTR1 to modify the MED, it would not have the intended effect on the outbound direction from Site 2's perspective.

To go further in the context of your example, site 2 configures lower MED on Link 1 than on Link 2, and this is applied outbound from Site 2. When RTR1 receives BGP updates from Site 2, the MED values are already set based on Site 2's outbound policy.
Applying a route-map inbound on RTR1 to modify the MED would not change the values that site 2 has already set. It would only affect the MED values that RTR1 advertises to its neighbors.

If you want to influence inbound traffic from the perspective of the neighbor, you might consider using other attributes such as AS_PATH, local preference, or weight.

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Hi M02@rt37 ,

The MED can actually be set inbound or outbound. So let's say you want site1 to prefer one link over the other, you could set the MED outbound on site2 for updates sent to site1 or set the MED inbound on site1 for updates received from site2. Both would work.

I would agree that setting the MED outbound is more commonly seen though.

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

MED attribute can be set both inbound and outbound in BGP. While it is more commonly seen and widely used when set outbound, there are scenarios where setting it inbound might be appropriate.

When setting the MED inbound, the goal is to influence the decision-making process on the receiving router's side. This approach can be effective when you want to control the incoming traffic from a neighboring AS and guide it to prefer one path over another.

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Hi M02@rt37 ,

Again, setting the MED inbound on site1 or outbound on site2 would still meet the same end goal of controlling the outbound traffic from site1 to site2.

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

@Harold Ritter 

You mean you set the MED inbound on site 1 or outbound on site 2, the goal of controlling the outbound traffic from site 1 to dite 2 remains the same ? In either case, you are influencing the decision-making process on the side of the receiving router (Site 2) to prefer one path over another.

I hope we are agree.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Hi M02@rt37 ,

In either case, you are influencing the decision-making process on the side of the receiving router (Site 2) to prefer one path over another.

Yes, I do agree

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

Martin L
VIP
VIP

in case you have 2 links to same AS (as ur case of R2 from R1) and you do not have access to R2 (i.w. R2 is ISP) but you want to do load balance traffic, you could use MED.   You can configure R1 to load balance the traffic it receives from r2 (utilize MED) and force traffic for one network down one path, and traffic for the other network down the other path.

note: MEDs are compared only if the first AS in the AS_SEQUENCE is the same for multiple paths.

see example https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13759-37.html#med

Regards, ML
**Please Rate All Helpful Responses **

You can config MED inbound and outbound' in real all bgp attribute can use in both inbound and outbound.

The issue is the order of attribute in best path selection 

If ypu use use it inbound then MED will come after weigh and LP and as-path.

So if I want to prefer one path I can use weight and LP in inbound since best path begin with it.

But ypu will thinking if that so why I dont use weight and LP in outbound? Here other factors effect which attribute you use' weight and LP dont send in ebgp' and hence ypu see many use MED or AS-Path (prepend) to prefer one path in outbound.

Hope this clear 

Have a nice day 

MHM

Review Cisco Networking for a $25 gift card