<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Ciao raga,</p>
    <p>finalmente la ML operativa... mi mancava tanto!</p>
    <p>Con Francesco @EliAran (su Telegram) abbiamo provato e funziona
      bene Bird2 con vari protocolli per sostitire olsrd2 che ormai non
      era più supportato.</p>
    <p>Per la rete mesh abbiamo usato il pacchetto avahi-autoip che
      assegna un ip random al bridge br-mesh</p>
    <p>In Basilicata abbiamo usato per la VPN zerotier e la config di
      bird è predisposta anche per il routing su IPv6 per quando tutti i
      nodi avranno up IPv6 pubblico.<br>
    </p>
    <p>Condivido qui la config se può servire a qualcuno e se si vuole
      iniziare ad usarlo migliorandolo... anche perchè con Bird2 si
      possono fare tante altre cose, come BGP etc..</p>
    <p>Sul server ho questa config</p>
    <pre># Configure logging
log syslog all;
log "/var/log/bird.log" all;
log stderr all;
router id from "ztknuuh73j";
# Sync bird routing table with kernel
protocol kernel kernel4 {
    description "Kernel protocol for IPv4";
    metric 50;
    ipv4 {
        export all;
        import all;
    };
};
protocol kernel kernel6 {
    description "Kernel protocol for IPv6";
    metric 300;
    ipv6 {
        table master6;
        export all;
        import all;
    };
};
protocol device {
    description "Device protocol";
};
protocol babel {
    description "Babel protocol for NINUX network";
    ipv4 {
        export where source = RTS_BABEL;
  import filter {
            if net = 0.0.0.0/0 then reject;
            accept;
  };
    };
    ipv6 {
        export where source = RTS_BABEL;
  import filter {
            if net = ::/0 then reject;
            accept;
  };
    };
    interface "ztknuuh73j" {
        check link yes;
        rxcost 600;
    };
}

</pre>
    <p>Sul router ho questa</p>
    <pre># Configure logging
log syslog all;
#log "/var/log/bird.log" all;
log stderr all;
router id from "br-lan";

# Sync bird routing table with kernel
protocol kernel kernel4 {
    description "Kernel protocol for IPv4";
    scan time 20;
    learn yes;
    metric 50;
    merge paths yes;
    ipv4 {
        table master4;
        export filter {
            if (proto = "lan") then reject;
            accept;
        };
        import filter {
            if (net = 0.0.0.0/0) && (ifname != "br-mesh") then accept;
            reject;
        };
    };
};

protocol kernel kernel6 {
    description "Kernel protocol for IPv6";
    scan time 20;
    learn yes;
    metric 300;
    merge paths yes;
    ipv6 {
        table master6;
        export filter {
            if proto = "lan" then reject;
            accept;
        };
        import filter {
            if (net = ::/0) then accept;
            reject;
        };
    };
};

protocol device {
    description "Device protocol";
    scan time 10;
};

protocol direct lan {
    description "LAN protocol";
    ipv4;
    ipv6;
    interface "br-lan";
    check link no;
}

protocol babel ninux {
    description "Babel protocol for NINUX network";
    ipv4 {
        export where (source = RTS_DEVICE) || (source = RTS_BABEL) || (net != 0.0.0.0/0);
        import where (net != 0.0.0.0/0);
    };
    ipv6 {
        export where (source = RTS_DEVICE) || (source = RTS_BABEL) || (net != ::/0);
        import where (net != ::/0);
    };
    interface "owzt0192af" {
        check link yes;
        rxcost 600;
    };
## Used to connect with other neighbours on the same layer 2 network.
## Decomment the config to use it, not this comments of course!
## Use the correct name interface, not the logical openwrt/(l)uci one.
## You can define more interfaces maches using * in regex (like "ifnet*")
## or "ifnet1", "ifnet2", "ifnetN", "otherifnetnames" form.
## You can also define more interfaces with other parameters, please refer to:
## <a class="moz-txt-link-freetext" href="https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.1">https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.1</a>
## After, reload the bird daemon with: /etc/init.d/bird reload
## or if you perefer, reastart with: /etc/init.d/bird restart
    interface "br-mesh" {
        type wireless; # or wired
        check link yes;
    };
}

protocol bfd {
    interface "br-mesh" {
        min rx interval 20 ms;
        min tx interval 50 ms;
        idle tx interval 300 ms;
    };
}

protocol ospf v3 internet_v4 {
    ipv4 {
        import filter {
            if (net = 0.0.0.0/0) && (ifname = "br-mesh") then accept;
            reject;
        };
        export filter {
            if (source = RTS_INHERIT) && (net = 0.0.0.0/0) then accept;
            if (source = RTS_OSPF) && (net = 0.0.0.0/0) then accept;
            reject;
        };
    };
    ecmp yes;
    merge external yes;
    area 0 {
        interface "br-mesh" {
            type broadcast;
            check link yes;
            bfd no;
        };
        interface "wan" {
            check link yes;
            stub yes;
        };
    };
};

## Ninux network currently does not deploy v6 global addresses,
## when it will happen, this config can be used to reach the ipv6 enabled
## routers for default IPv6 route (usually, to Internet).
## Simply uncomment all below to use.
#protocol ospf v3 internet_v6 {
#    ipv6 {
#        import filter {
#            if (net = ::/0) && (ifname = "br-mesh") then accept;
#            reject;
#        };
#        export filter {
#            if (source = RTS_INHERIT) && (net = ::/0) then accept;
#            if (source = RTS_OSPF) && (net = ::/0) then accept;
#            reject;
#        };
#    };
#    ecmp yes;
#    merge external yes;
#    area 0 {
#        interface "br-mesh" {
#            type broadcast;
#            check link yes;
#            bfd no;
#        };
#        interface "wan" {
#            check link yes;
#            stub yes;
#        };
#    };
#};
</pre>
  </body>
</html>