Filter based on condition or watchdog

Mike Jones mike at mikejones.in
Fri Jun 2 16:20:39 CEST 2017


On 2 June 2017 at 11:59, Войнович Андрей Александрович
<andreyv at skbkontur.ru> wrote:
> Hi all!
>
>
>
> Does BIRD allow to write a filter, where I can define a condition when it
> should import/export some route(s) and when it should not? To clarify my
> question, example: I want to check whether some process (lets say apache) is
> running and the server is listening TCP port 80, so if these conditions are
> true, BIRD should export some route to OSPF, if false – should not.

Hi,

You will need some external monitoring script to handle this. To
withdraw a route when a service fails there is a simpler option to
have bird import from the kernel routing table and use an external
script to add/remove routes.

if `wget -O/dev/null https://u4477715.ct.sendgrid.net/wf/click?upn=IRP6gkWjxp-2BUYovgLeGtGDf-2FKzs9-2Fhju5HKAky8ItZKqaICIOXTZr0BuZdlkVdpt_Hxo-2FoQ8RT5Sq39sL4VO44lHljDtNu7KAecam4tHq6mJe7fxojlkgRTj6QD01quksIGPbTAS7-2FH-2BvzzMWOwtyRSrLD7SEFUaoEAGV4tBDoTTkaw6YnQRZk2F1LqkKQ4lYaelYp0DnIHw5hMSRl3xJ6UYV2MaY1FTx9uEptBDu5WhqwSXHlHyQ1PzzXk2DDGxhVp56AqT-2BJusMMSL38Wcto42Igr7wXopmNouv0k5wEas-3D then
    ip route add 1.2.3.4/32 dev lo
else
    ip route del 1.2.3.4/32 dev lo
fi

Something like that in a while loop or cron job should be simpler than
changing config files. Of course, this only works for the "turn off my
advertisements when I’m broken" use case and isn't suitable for more
complex requirements.

You can also use an alternative kernel routing table purely for
injecting in to bird if you don't want the routes in your main routing
table.

- Mike Jones



More information about the Bird-users mailing list