1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00
mdlayher-homelab/nixos/routnerr-2/dhcpd6.nix
Matt Layher 9746f3547b
nixos/routnerr-2: add tengb0 on VLAN 100
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-24 12:30:08 -04:00

54 lines
1.4 KiB
Nix

{ lib, ... }:
let vars = import ./lib/vars.nix;
in {
services.dhcpd6 = {
interfaces = with vars.interfaces; [
"${enp2s0.name}"
"${lan0.name}"
"${guest0.name}"
"${iot0.name}"
"${lab0.name}"
"${tengb0.name}"
];
enable = true;
extraConfig = ''
ddns-update-style none;
default-lease-time 600;
max-lease-time 600;
option dhcp6.bootfile-url code 59 = string;
option dhcp6.rapid-commit;
${with vars.interfaces;
lib.concatMapStrings (ifi:
# Router ULA addresses have a ::1 suffix, so trim the 1 from the
# router's address for our /64 prefix.
let
pfx = lib.removeSuffix "1" ifi.ipv6.ula;
ipv6 = ifi.ipv6.ula;
in ''
subnet6 ${pfx}/64 {
range6 ${pfx}ffff:1000 ${pfx}ffff:ffff;
range6 ${pfx} temporary;
option dhcp6.name-servers ${ipv6};
# TODO: find a working IPv6 TFTP implementation and enable.
# option dhcp6.bootfile-url "tftp://[${ipv6}]/netboot.xyz.kpxe";
${
# Configure additional options for the primary internal LAN.
if ifi.internal_domain then ''
option dhcp6.domain-search "${vars.domain}";
'' else
""
}
}
'') [ enp2s0 lan0 guest0 iot0 lab0 tengb0 ]}
'';
};
}