bgp template inheritance
Hello, I'm trying to simplify my old bird 1.6 config, the aim is migrating to v2 then v3. I have a config like : template bgp private_peering_ipv4 { local as my_ans; path metric 2; ipv4 { import all; import filter { if (net.len > 24 ) then reject; bgp_large_community.add((my_asn, 1, 1003)); accept; }; export filter export_my_routes_ipv4; import keep filtered; }; } protocol bgp PEER_v4_peer1 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; } protocol bgp PEER_v4_peer2 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; ipv4 { import filter { bgp_large_community.add((my_asn, 1, 1009)); accept; }; }; } the problem here is that as soon as I define a new import filter for my second peer, the filter from the template is omitted. Is there a way to add inheritance between the templates, or anything else that wouldn't overwrite the template filters ? Regards, Cédric
Hello, No, in the template you can set a "default" filter for example. But if you set the filter in the template's child, the setting gets overwritten. Regards, Alexander On Tue, Mar 3, 2026 at 12:49 PM BASSAGET Cédric < cedric.bassaget.ml@gmail.com> wrote:
Hello,
I'm trying to simplify my old bird 1.6 config, the aim is migrating to v2 then v3.
I have a config like :
template bgp private_peering_ipv4 { local as my_ans; path metric 2; ipv4 { import all; import filter { if (net.len > 24 ) then reject; bgp_large_community.add((my_asn, 1, 1003)); accept; }; export filter export_my_routes_ipv4; import keep filtered; }; }
protocol bgp PEER_v4_peer1 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; } protocol bgp PEER_v4_peer2 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; ipv4 { import filter { bgp_large_community.add((my_asn, 1, 1009)); accept; }; }; }
the problem here is that as soon as I define a new import filter for my second peer, the filter from the template is omitted.
Is there a way to add inheritance between the templates, or anything else that wouldn't overwrite the template filters ?
Regards, Cédric
Hi Cédric, inheritance of filters is not supported, but you can make use of functions (https://bird.nic.cz/doc/bird-2.18.html#filters) to not repeat yourself. We are glad that you are switching to v2/v3. You will most likely be able to use the same exact configuration for v2 and v3. Hope this helps and happy routing, David David Petera (he/him) | BIRD Tech Support | CZ.NIC, z.s.p.o. On 3/3/26 12:40, BASSAGET Cédric wrote:
Hello,
I'm trying to simplify my old bird 1.6 config, the aim is migrating to v2 then v3.
I have a config like :
template bgp private_peering_ipv4 { local as my_ans; path metric 2; ipv4 { import all; import filter { if (net.len > 24 ) then reject; bgp_large_community.add((my_asn, 1, 1003)); accept; }; export filter export_my_routes_ipv4; import keep filtered; }; }
protocol bgp PEER_v4_peer1 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; } protocol bgp PEER_v4_peer2 from private_peering_ipv4 { router id 195.42.145.x; neighbor 195.42.144.104 as 6939; ipv4 { import filter { bgp_large_community.add((my_asn, 1, 1009)); accept; }; }; }
the problem here is that as soon as I define a new import filter for my second peer, the filter from the template is omitted.
Is there a way to add inheritance between the templates, or anything else that wouldn't overwrite the template filters ?
Regards, Cédric
participants (3)
-
Alexander Zubkov -
BASSAGET Cédric -
David Petera