manipulating the best path, eBGP, MED?

Jerry Scharf jerry at
Tue Mar 7 20:35:20 CET 2017

I always use aspath stuffing rather than MED for this kind of thing. 
After localpref, the next level of choice for a bgp route is the AS path 
length, with shorter winning.

Say you want prefix 1 to always prefer hv1 and prefix2 to prefer hv2. On 
hv2, prepend your AS onto prefix 1 and on hv1, prepend your AS onto 
prefix2. When the other end receives the routes, it will see that the AS 
path length is longer to prefix1 from hv2, so it will always prefer hv1. 
If hv1 dies, then it will only have the hv2 route and that will be used. 
When hv1 starts advertising prefix 1 again, the traffic will flow back 
to hv1.

It may seem a little gross, but it is simple and effective. MEDs are 
much trickier and were designed for the case when you have two different 
connections through an intervening AS between the source and destination AS.

On 3/7/17 11:16 AM, Thomas at PhaseHosting wrote:
> Supp,
> I want to send the med with eBGP to my hosts their routers so i can 
> influence where the network traffic enters my virtual envirement. I 
> have 3 hypervisors that run bird.
> I can only controll the traffic from my virtual envirement to the 
> internet, because this runs on bird and ucarp. So through the 
> hypervisor where the ucarp interface is placed does my traffic leave. 
> this subnet is also distributed to the other hypervisors through iBGP.
> These hypervisors have all an eBGP connection to my hosts addressing 
> the subnet. So hypervisor 1 isnt the single point of failure. But know 
> the best route (at my hosts to my subnet) is chosen on router age. So 
> in case the first hypervisor dies and the second takes over everything 
> works. but if the first hypervisor comes back alive the eBGP 
> connection from hypervisor 2 stays because of its age.
> I want to send a med value on all the eBGp connections from the 
> hypervisors. So my hosts routes always first to hypervisor 1 and then 
> to 2 and so on.
> so is this the right configuration to send a med value to my host with 
> the subnet as static route:
> # your default gateway IP below here
> protocol bgp eBGP {
> import none;
> export  filter {
>           where proto = "static_packet";
>           bgp_med = 100;
>            };
> local as 65000;
> neighbor 10.80.x.x as 65530;
> password "SECRET";
> }
> Op 3/7/2017 om 7:08 PM schreef Ondrej Zajicek:
>> On Tue, Mar 07, 2017 at 03:43:13PM +0100, Thomas at PhaseHosting wrote:
>>> Supp,
>>> thnqx for the reply,
>>> The BGP i have figured out and i have confirmation from my host they 
>>> accept
>>> customer-set MEDs. Only i couldn't get these working and i found 2 
>>> posts on
>>> the internet with a different configuration and i don't know which 
>>> one is
>>> the right one, "med metric 10;" or "default bgp_med 10;"
>>> Am i right that MED is the only option to influence the  eBGP and 
>>> manipulate
>>> the prefered path? ( Values like AS are the same and others are not
>>> accepted)
>> Hi
>> I do not understand if you are trying to manipulate your 
>> hosts/routers (i.e.
>> outgoing direction) or neighbors routers (i.e. incoming direction).
>> Both could be influenced by bgp_med attribute (e.g. 'bgp_med = 100;' in
>> import or export filter) assuming your neighbors are from the same AS.
>> Option 'default bgp_med' is probably not what you want, that is used 
>> only if
>> a route with MED is compared to a route without MED.
>> Option 'med metric' could be used if you want to compare bgp_med
>> attributes on routes received from different AS numbers. But it is a
>> true/false option, the MED still must be set in filters.

Soundhound Devops
"What could possibly go wrong?"

More information about the Bird-users mailing list