12-20-2025 10:58 AM
I learned that MED is applied to outbound updates , dictating the best inbound traffic into the AS, but I saw the vice-versa is also true like you can apply med for indbound updates also and it works the same right??
12-20-2025 11:21 AM - edited 12-20-2025 05:21 PM
Hello there..
Yes and no..
MED is a value that is announced to neighbors, influencing inbound traffic.
But BGP is so flexible, you can manipulate inbound announcements and act as if the neighbor would have set a MED. Like this:
ip prefix-list PL-IN seq 5 permit x.x.x.x/xx
route-map RM-IN permit 10
match ip address prefix-list PL-IN
set metric 60
router bgp xxx
neighbor x.x.x.x route-map RM-IN in
12-20-2025 11:35 AM
Yeah, I got it now from another thread that MED can be used in both direction but it should be applied in out direction because if you want to influence inbound updates why don't simply use weight or local prefrence right??
12-20-2025 05:19 PM
Well this is a BGP Design question where the answer might be different in each network.
Weight ... this is a Cisco-proprietary thing, which is always only local to a single router, steering outbound traffic flow. Weight can never steer inbound traffic flow from a router's point of view.
Local Preference ... similar to Weight it is steering outbound traffic flow, but this attribute is propagated within the same AS, meaning if you configure Local Pref on a router, it will announce this to iBGP peers. From a whole AS perspective, Local Pref can only steer outbound traffic flow, never inbound traffic flow.
Now MED ... MED is different, MED is designed to influence INBOUND traffic flow. By design a value in the MED attribute is announced to neighbors to influence how traffic is sent to us.
But you can manipulate incoming BGP announcements by setting a MED value .. technically you are then influencing outbound traffic flow with MED, but only by manipulating announcements from neighbors to make them look like as if the neighbor announces a MED value. You just need to be very careful here... the default MED on routes where no MED is set, is 0 ... and moreover, MED is only compared for routes received from the same AS per default. Keeping that in mind - if you want to use MED for steering outbound traffic, you really need to be sure that you set a MED (preferably a different value) to each and every route that needs to be compared. Otherwise the one without MED will win. You'll also want "bgp deterministic-med" to be enabled, and if you want to compare routes announced from different AS' also "bgp always-compare-med"!
At the end of the day, yes, you can use all three methods to influence outbound traffic flow.
MED is just most likely the most inconvenient one to do so, since weight and local-pref both are easier to configure (for outbound traffic control) as well as they come before MED in the BGP Best Path Selection.
Hope this helps!!
12-21-2025 12:23 AM - edited 12-21-2025 12:24 AM
Hello @parthrawat979
MED can be modified either inbound or outbound, but the effect is not symmetrical !!!
If you want site A to prefer one link over another, the correct method is to set the med outbound on site B for routes advertised to site A, since med is meant to influence the neighbor’s path selection...
While you can change med inbound on site A, that only affects site A’s local decision process and any re-advertisement of the route ; it does not truly replace the outbound use case.
So for that reason, setting med attribute in outbound is the standart and recommended approach.
12-21-2025 01:30 AM
@parthrawat979 MED is set on outbound BGP updates to influence how external neighbors choose an entry path into your AS-when you “apply MED inbound,” you are actually modifying the received MED locally for your own path selection—it does not influence the remote AS.
12-21-2025 01:50 AM
I don't know a lot but it worked as expected. Like if I set the higher value of med for a certain neighbor with a route-map in the inbound direction then the router receiving the update will no longer choose the router with higher med as best path.
12-21-2025 04:29 AM
I also had a quick re-visit to the lab before writing my comments. You can achieve the desired outcome of influencing outbound traffic flow with MED set on inbound direction.
But the others here in the thread are also right ... it is not recommended and if you choose to do it, be very careful.
For outbound traffic flow steering, both Weight and Local Pref are easier to handle and also recommended to use.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide