How to make bird and freebsd carp working together ?

Marek Zarychta zarychtam at plan-b.pwste.edu.pl
Mon Apr 1 15:51:35 CEST 2024


W dniu 1.04.2024 o 00:50, Arnaud Houdelette-Langlois via Bird-users pisze:
>
> Hi
>
> I got two routers running freebsd (BSDRP).
>
> Those two are used as redundant site firewalls and main routers / 
> route servers.
>
> Both exchange routes between themselves and other routers using Bird 
> (OSPF+BGP).
>
> Both serve as gateway for our management network, with carp enabled.
>
> I got trouble making CARP and BIRD working together.
>
> The carp enabled interface use a dummy network for exchanging carp 
> info (link local adresses : 169.254.1.0/24)
>
> Bird Device protocol does not makes any difference between adresses in 
> MASTER or BACKUP vhids, so the route appears in both routers.
>
> I tried with recent "learn all" feature of kernel protocol : There, 
> bird only picks up route when its master, but, in case of MASTER 
> failover or preemption, it doesn't remove the route early enough, and 
> freebsd does not seem to replace the route on it’s kernel table, so 
> when birds finally removes the route, we end up with no route at all. 
> (and a non working network segment).
>
> Am I the only one facing this issue ? Is there a way to make bird carp 
> aware ?
>

Sure, the best way to let BIRD know that CARP state has changed is to 
deploy devd(8):

# /etc/devd/carp.conf
notify 0 {
        match "system"          "CARP";
        match "subsystem"       "[0-9]+@[0-9a-z]+";
        match "type"            "(MASTER|BACKUP)";
        action "/root/bin/carpcontrol.sh $subsystem $type";
    };


# /root/bin/carpcontrol.sh
#!/bin/sh
subsystem=$1
type=$2
vhid="6"
c_if="vlanX"             # CARP interface1
(...)

bird_remove_routes() {

here change configs, reconfigure bird etc

}

bird_add_routes() {

here change configs, reconfigure bird etc

}

if [ "$subsystem" = "$vhid@$c_if" ]; then
     case $type in
       "MASTER")
           bird_add_routes
           ;;
       "BACKUP")
           bird_remove_routes
           ;;
     esac
fi

Happy routing !

Cheers

-- 
Marek Zarychta



More information about the Bird-users mailing list