Use presence of route to enable/disable BGP session
Cybertinus
bird at cybertinus.nl
Wed Nov 24 22:16:01 CET 2021
Hello,
What also might be an idea is too keep both sessions up all the time,
but give the routes recieved from the backup connection a lower
preference. If you receive the same routes from both connections, then
the routes learned from the primary connection will be used. If this
connection fails, then the router will use the routes learned from the
backup connection. If the primary connection comes back, the router will
fail back to the primary connection.
But this idea only works when you learn the same routes from both
connections. If you ever learn a unique or more specific route only via
the backup connection, the connection will be used for those routes. So,
it depends on the routes you learn if this idea will work or not.
Kind regards,
Cybertinus
On 2021-11-24 09:55, Maria Matejka wrote:
> 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