Use presence of route to enable/disable BGP session

Maria Matejka maria.matejka at nic.cz
Wed Nov 24 09:55:24 CET 2021


Hello!

This is not possible at all. We may implement something like this in 
near future, yet since it heavily depends on some now-unstable code, 
you'd be better for now to do it by an external script.

You can also, instead of calling birdc show route repeatedly, use 
something like 'ip monitor' command (on Linux) or 'route -n monitor' (on 
BSD) to get the updates from kernel table as they come in and process 
them immediately.

Maria

On 11/23/21 8:20 PM, bird21 at sensation.net.au wrote:
> Hi all,
> 
> I want to enable a backup BGP session (or perhaps, keep the session up 
> and change the import/export filters) only when the main peer goes down 
> (default disappears)
> 
> Conceptually, I want to do something like this:
> 
> if net = 0.0.0.0/0 then {
>     if from = x.x.x.x then {  # x.x.x.x = main peer
>       disable backup_bgp_session;
>     } else {
>       enable backup_bgp_session;
>     }
> }
> 
> Obviously this doesn't work, since disable/enable cannot be used in the 
> config. The logic is also a little flawed.
> 
> I thought about setting a global variable in one filter, and using that 
> variable in another to decide what to export to the backup peer, but it 
> seems that BIRD only supports local variables?
> 
> I can fudge it by using an external script to query "birdc show route 
> 0.0.0.0/0" to check for the presense of default, and then "birdc enable 
> backup_bgp_session" or "birdc disable backup_bgp_session" as 
> appropriate, but I'd prefer to be able to do it within BIRD.
> 
> Hope someone can give me some hints. Thanks.
> 


More information about the Bird-users mailing list