From 9615317bf67831ceb901896e61b2dcf3955ed7a5 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 8 Apr 2021 01:43:02 +0200 Subject: [PATCH] nixos-module/container/upstream: enable dhcpv6 prefix delegation --- nix/nixos-module/container/upstream.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/nix/nixos-module/container/upstream.nix b/nix/nixos-module/container/upstream.nix index 31c707d..941f73e 100644 --- a/nix/nixos-module/container/upstream.nix +++ b/nix/nixos-module/container/upstream.nix @@ -12,8 +12,25 @@ let else null; in { - systemd.network.networks = builtins.mapAttrs (_: { upstream, ... }: { + systemd.network.networks = { + core = { + # systemd-networkd only requests Prefix Delegation via DHCPv6 on + # the upstream interface if another interface is configured for it. + # without this, the static ipv6 subnet won't be routed to us. + extraConfig = '' + [Network] + IPv6PrefixDelegation=dhcpv6 + ''; + dhcpV6PrefixDelegationConfig = { + SubnetId = "81"; + # because we have static addresses, we don't actually use this + Assign = false; + }; + }; + } // builtins.mapAttrs (_: { upstream, ... }: { DHCP = "yes"; + networkConfig.IPv6AcceptRA = true; + dhcpV6Config.PrefixDelegationHint = "::/56"; extraConfig = '' [CAKE]