BGP - MED vs AS Prepending

When using BGP to influence incoming traffic, there are several options that can be used. Among the most commonly used are the MED and the AS Prepending attributes.

Which attribute you will use depends on your situation as well as the capabilities and configurations of your neighboring AS. Let’s take a look at each option:

MED is an optional, non-transitive BGP attribute that suggests to external neighbors the preferred path into your AS. A lower MED value is preferred over a higher one. The MED attribute can be very effective, but it’s not always the best solution because its interpretation can vary depending on the BGP configurations on neighboring AS. Moreover, the MED is not always transmitted through multiple ASes, making it less effective in scenarios where you are trying to influence routing decisions several hops away.

AS Path Prepending involves adding additional instances of your own AS number to the AS path of certain routes. This makes the path seem longer, so it is less likely to be chosen by BGP, which prefers shorter paths. AS Path Prepending is a more aggressive way to influence inbound traffic because it will be seen by all BGP routers that receive your announcements, not just your immediate neighbors.

However, the best approach is to talk with the administrators of your neighboring AS (i.e. your ISP) before configuring any BGP attributes that influence incoming traffic. Make sure that what you have configured is acceptable on their end as well. You may find that one or the other option may be frowned upon and may be considered aggressive by your ISP if not discussed beforehand.

Generally speaking, MED may be a better choice when you’re only dealing with direct peers or neighbors, and you can be sure they’ll honor MED. AS Path Prepending might be more suitable if you want to ensure your changes will be seen throughout the internet, or you’re dealing with networks that ignore MED.

Links:

https://forum.networklessons.com/t/how-to-configure-bgp-as-path-prepending/954/90?u=lagapides

https://networklessons.com/bgp/how-to-configure-bgp-as-path-prepending

https://networklessons.com/bgp/how-to-configure-bgp-med-attribute