nixos-module/container/bird: add radv

This commit is contained in:
Astro 2021-04-06 22:46:56 +02:00
parent e9a2092608
commit daa7bef9d5
1 changed files with 28 additions and 10 deletions

View File

@ -2,6 +2,13 @@
let
hostConf = config.site.hosts.${hostName};
gatewayNet =
let
m = builtins.match "(.+)-gw" hostName;
in if m == null
then null
else builtins.head m;
in
{
services.bird2 = {
@ -23,16 +30,27 @@ in
scan time 10;
}
# protocol radv {
# interface "c3d2" {
# min ra interval 10;
# max ra interval 60;
# prefix ::/64 {
# preferred lifetime 20;
# valid lifetime 60;
# };
# };
# }
${lib.optionalString (gatewayNet != null) ''
protocol radv {
rdnss ${config.site.net.serv.hosts6.dn42.dnscache};
interface "${gatewayNet}" {
min ra interval 10;
max ra interval 60;
${builtins.concatStringsSep "\n" (
map (subnet6: ''
prefix ::/64 {
preferred lifetime 20;
valid lifetime 60;
};
'') (builtins.attrValues config.site.net.${gatewayNet}.subnets6)
)}
dnssl "${config.site.net.${gatewayNet}.domainName}";
};
}
''}
protocol ospf v2 ZW4 {
area 0 {