recursive next-hop from filter
Manon Goo
lists at manon.de
Thu Mar 25 13:50:52 CET 2021
Dear Maria,
Thanks alot for taking your time for my iussue. let me describe my
usecase: we are using carp(4) with freebsd as our first-hop redundancy
protocol. I want to have the primary carp node announce his routes
with a preferred priority (lower OSPF ospf_metric1 or BGP Community
that is evaluated by peer). This works well for a scenario where we
are using static recursive routes, but not as well when using routes
learnt from an other router.
We have two routers each with an interface in our LAN, these routers
share one IP address that is installed with the freebsd carp feature
(similar to vrrp). This IP Address can be either in MASTER or BACKUP
state. When the carp-address is in MASTER state, the Address is learnt
via protocol KERNEL and the loopback interface; when the carp-address
is in BACKUP state the the Address is learnt via protocol DIRECT and
the interface connected to the MASTER.
We install the routes with our carp address as recursive next-hop. And
when exporting the routes to the OSPF or BGP peers we apply an export
filter that checks if ifname is loopback and prefers the routes
accordingly:
protocol static static_recursive_carp {
preference 400;
route 192.168.123.0/24 recursive 1.1.1.1
route 0.0.0.0/0 recursive 1.1.1.1
}
protocol ospf OSPF_1 {
export filter ospf_preferr_carp_master;
[...]
}
filter ospf_preferr_carp_master;
{
if proto = "static_recursive_carp" && net ~ [ 0.0.0.0/0,
192.168.123.0/24 ] then {
if defined(ifname) && ifname = "lo0" then {
ospf_metric1 = 10;
accept;
}
ospf_metric1 = 32767;
accept;
}
reject;
}
filter bgp_preferr_carp_master;
{
if proto = "static_recursive_carp" && net ~ [ 0.0.0.0/0,
192.168.123.0/24 ] then {
if defined(ifname) && ifname = "lo0" then {
bgp_local_pref = 120;
bgp_community.add(COMM_LP_PREFERRED_120);
accept;
}
bgp_local_pref = 80;
bgp_community.add(COMM_LP_PREFERRED_80);
accept;
}
reject;
}
When the carp BACKUP is promoted to MASTER, the recursive route is
re-evaluated by bird and the export filter is re-applied, the new
ifname is lo0 and the route is announced with the preferable metric or
local pref.
I would like to be able to add this behaviour routes learnt from an
other protocol. This works with BGP but is rather ugly:
- the bgp speaker must announce the route with bgp_next_hop set to the
carp address of the bgp peer
- the peer must have "gateway recursive" set
For OSPF this does not seam possible.
What would be helpfull form me:
to be able to set a recusive route from a filter or function with a
statement like
set_recursive(gw, table)
or to have an other measure to update routes in case of an event.
Perhaps to allow to set a dependency to an other route on a route.
And reevaluate the route if the depending route changes. and to have
the possibility
to access the depending routes attributes perhaps like follows:
filter myfilter {
set_depend(1.1.1.1, "my_tracking_table_v4")
bgp_local_pref = get_depend.bgp_local_pref + 10
}
Kind regards, and thanks again for taking your time.
Manon
Quoting Maria Matejka <maria.matejka at nic.cz>:
> Hello!
>
> If I understand your query corretly, you want to change the "igp
> table" setting on a per-route basis in filters. This is currently
> impossible due to the architecture of recursive nexthop resolution.
>
> Could you please describe a use case for that? We may find another
> way to get you to your goal or get a good reason to change the
> implementation.
>
> Maria
>
> On 3/25/21 2:31 AM, Manon Goo wrote:
>>
>> Hallo,
>>
>>
>> Is it possible to set or modify a recursive next-hop and the
>> loop-up table for a route from a filter or function ?
>>
>> Kind regards,
>> Manon
>>
>>
>>
>>
>>
More information about the Bird-users
mailing list