Add ipv6 subnet to wireguard

This commit is contained in:
Clayton Hickey 2025-11-19 14:48:05 -05:00
parent f5c131c3ea
commit e68c98b63c
2 changed files with 17 additions and 2 deletions

View file

@ -203,6 +203,7 @@
dig
ncdu
servo
tcpdump
];
sessionVariables = {
EDITOR = "${inputs.cnvim.packages.x86_64-linux.default}/bin/nvim";

View file

@ -22,6 +22,9 @@ in
type = lib.types.str;
default = "${cfg.baseIP}.${builtins.toString cfg.clientPubOptionsMap.${host}.clientNumber}";
};
ipv6 = lib.mkOption {
default = "${cfg.baseIPv6}${builtins.toString cfg.clientPubOptionsMap.${host}.clientNumber}";
};
port = lib.mkOption {
type = lib.types.port;
default = 51820;
@ -39,10 +42,18 @@ in
type = lib.types.str;
default = "10.100.0";
};
baseIPv6 = lib.mkOption {
type = lib.types.str;
default = "fc10::";
};
clientInternalIP = lib.mkOption {
type = lib.types.str;
default = cfg.clientPubOptionsMap.${config.cos.hostName}.ip;
};
clientInternalIPv6 = lib.mkOption {
type = lib.types.str;
default = cfg.clientPubOptionsMap.${config.cos.hostName}.ipv6;
};
clientInternalPort = lib.mkOption {
type = lib.types.port;
default = cfg.clientPubOptionsMap.${config.cos.hostName}.port;
@ -74,7 +85,7 @@ in
enable = true;
interfaces = {
${cfg.interface} = {
ips = [ "${cfg.clientInternalIP}/24" ];
ips = [ "${cfg.clientInternalIP}/32" "${cfg.clientInternalIPv6}/128" ];
listenPort = cfg.clientInternalPort;
privateKeyFile = cfg.privateKeyFile;
@ -82,7 +93,10 @@ in
peers = [
{
publicKey = cfg.clientPubOptionsMap.loadedskypotato.publicKey;
allowedIPs = [ "${cfg.baseIP}.0/24" ];
allowedIPs = [
"${cfg.baseIP}.0/24"
"${cfg.baseIPv6}/64"
];
endpoint = "${config.cos.knownPublicIPs.loadedskypotato}:${builtins.toString cfg.clientPubOptionsMap.loadedskypotato.port}";
persistentKeepalive = 25;
}