From 68534d2ce230135185080612621cd4ea3d620bd6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 16 Oct 2019 13:48:13 +0800 Subject: [PATCH] nixbld: IPv6 on internal networks --- nixbld-etc-nixos/configuration.nix | 33 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 9335f50..e81d252 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -43,14 +43,26 @@ in trustedInterfaces = [ netifLan ]; }; networkmanager.unmanaged = [ "interface-name:${netifLan}" "interface-name:${netifWifi}" ]; - interfaces."${netifLan}".ipv4.addresses = [{ - address = "192.168.1.1"; - prefixLength = 24; - }]; - interfaces."${netifWifi}".ipv4.addresses = [{ - address = "192.168.12.1"; - prefixLength = 24; - }]; + interfaces."${netifLan}" = { + ipv4.addresses = [{ + address = "192.168.1.1"; + prefixLength = 24; + }]; + ipv6.addresses = [{ + address = "2001:470:f821:1::"; + prefixLength = 64; + }]; + }; + interfaces."${netifWifi}" = { + ipv4.addresses = [{ + address = "192.168.12.1"; + prefixLength = 24; + }]; + ipv6.addresses = [{ + address = "2001:470:f821:2::"; + prefixLength = 64; + }]; + }; nat = { enable = true; externalInterface = netifWan; @@ -78,6 +90,8 @@ in routes = [{ address = "::"; prefixLength = 0; }]; }; }; + boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = "1"; + boot.kernel.sysctl."net.ipv6.conf.default.forwarding" = "1"; services.hostapd = { enable = true; @@ -94,6 +108,9 @@ in bind-interfaces dhcp-range=interface:${netifLan},192.168.1.10,192.168.1.254,24h dhcp-range=interface:${netifWifi},192.168.12.10,192.168.12.254,24h + enable-ra + dhcp-range=interface:${netifLan},::,constructor:${netifLan},ra-names + dhcp-range=interface:${netifWifi},::,constructor:${netifWifi},ra-only ''; };