manipulating the best path, eBGP, MED?

Thomas Valgaeren thomas at phasehosting.io
Sat Apr 14 23:18:20 CEST 2018


Hey Jerry,

Sorry to bother you, as I was working on my BGP implementation I stumbled
across a problem.
This led me to the Bird mailing list on an article that described my problem
exactly. But it was an item I created with your answer describing the
solution.

At the time I forgot to go further in to this and never got a working state.

Prepending the AS path will probably solve the solution, as I am not good
with programming I would like to ask for help.

This is a part of my configuration:

filter filter_public {
if net = 147.75.102.216/32 then accept;
if net = 147.75.102.217/32 then accept;
if net = 147.75.102.218/32 then accept;
if net = 147.75.102.219/32 then accept;
if net = 147.75.102.220/32 then accept;
if net = 147.75.102.221/32 then accept;
if net = 147.75.102.222/32 then accept;
if net = 147.75.102.223/32 then accept;
}

### To hosting provider
protocol bgp BGP_provider {
export filter filter_public;
local as 65000;
neighbor IPADDRESS as 65530;
password "USjdRHAbPxqj9WxvTRhe";
}


### To other hypervisor

protocol bgp H2 {
import filter filter_public;
export filter filter_public;
local as 65000;
neighbor IPADDRESS as 65000;
next hop self;
}

### Source public ip from a VM

protocol bgp BGP_IPVM {
import filter filter_public;
export none;
local as 65000;
source address internalIP;
neighbor VMinternalIP as 65001;
}

So the VM delivers the public ip to the hypervisor. And the hypervisor to
the provider and the other hypervisor.
How can I prepend the AS path so the provider will know that when a VM is on
Hypervisor1. The path prefix from Hypervisor2 to the provider is 2. And the
provider sees that the prefix form hypervisor1 is 1, and choose this path?

Thanks in advance.

Regards Thomas


-----Original Message-----
From: Bird-users <bird-users-bounces at network.cz> On Behalf Of Jerry Scharf
Sent: dinsdag 7 maart 2017 20:35
To: bird-users at network.cz
Subject: Re: manipulating the best path, eBGP, MED?

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.

jerry
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