From b337e6201610748c8def522f306582c2b7308bab Mon Sep 17 00:00:00 2001 From: John Axel Eriksson Date: Sun, 2 Nov 2025 16:32:32 +0100 Subject: [PATCH 1/2] fix(cygnus): proper dns / ts fix --- configurations/nixos/x86_64-linux/cygnus.nix | 6 +++--- profiles/defaults.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configurations/nixos/x86_64-linux/cygnus.nix b/configurations/nixos/x86_64-linux/cygnus.nix index a546710d0..58ed33699 100644 --- a/configurations/nixos/x86_64-linux/cygnus.nix +++ b/configurations/nixos/x86_64-linux/cygnus.nix @@ -41,11 +41,11 @@ networking.useDHCP = false; - networking.nameservers = lib.mkForce []; + # networking.nameservers = lib.mkForce []; services.resolved = { enable = true; ## have fallbacks in case something is wrong - fallbackDns = ["1.0.0.1" "1.1.1.1" "2606:4700:4700::1111" "2606:4700:4700::1001"]; + # fallbackDns = ["1.0.0.1" "1.1.1.1" "2606:4700:4700::1111" "2606:4700:4700::1001"]; ## for some reason, systemd-resolved thinks upstream doesn't respond sometimes ## so we need to disable caching negative responses (plus some other stuff) ## again - this is about using tailscale dns only @@ -67,7 +67,7 @@ networkConfig.IPv6PrivacyExtensions = "yes"; networkConfig.IPv6AcceptRA = "yes"; ## don't use this by default (rely on tailscale dns only) - networkConfig.DNSDefaultRoute = false; + # networkConfig.DNSDefaultRoute = false; }; }; }; diff --git a/profiles/defaults.nix b/profiles/defaults.nix index 99a6deb36..c661dafe0 100644 --- a/profiles/defaults.nix +++ b/profiles/defaults.nix @@ -103,7 +103,7 @@ in { home-manager.useUserPackages = true; home-manager.useGlobalPkgs = true; - networking.nameservers = ["1.0.0.1" "1.1.1.1" "2606:4700:4700::1111" "2606:4700:4700::1001"]; + # networking.nameservers = ["1.0.0.1" "1.1.1.1" "2606:4700:4700::1111" "2606:4700:4700::1001"]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; From d75407f18a6bdc50ff9e78a912e0ce22ac7cde1d Mon Sep 17 00:00:00 2001 From: John Axel Eriksson Date: Sun, 2 Nov 2025 16:32:32 +0100 Subject: [PATCH 2/2] feat(router): wip ipv6 only network --- configurations/nixos/x86_64-linux/alnitak.nix | 42 +++--- .../nixos/x86_64-linux/sagittarius.nix | 127 +++++++++++++---- modules/router.nix | 131 +++++++++--------- 3 files changed, 184 insertions(+), 116 deletions(-) diff --git a/configurations/nixos/x86_64-linux/alnitak.nix b/configurations/nixos/x86_64-linux/alnitak.nix index 1ef57080d..ef2e5f780 100644 --- a/configurations/nixos/x86_64-linux/alnitak.nix +++ b/configurations/nixos/x86_64-linux/alnitak.nix @@ -43,27 +43,27 @@ args.auth-key = "file:/var/run/agenix/ts-google-9k"; }; - services.jae.router = { - enable = true; - useNextDns = true; - nextDnsEnvFile = "/var/run/agenix/nextdns"; - restrictedMacs = [ - "5c:e0:c5:8a:24:6a" - "b4:18:d1:ab:4e:5a" - ]; - upstreamDnsServers = [ - "2a07:a8c1::" - "45.90.30.0" - "2a07:a8c0::" - "45.90.28.0" - ]; - externalInterface = "enp1s0"; - internalInterface = "enp2s0"; - internalInterfaceIP = "192.168.20.1"; - dnsMasqSettings.no-resolv = true; - dnsMasqSettings.bogus-priv = true; - dnsMasqSettings.strict-order = true; - }; + # services.jae.router = { + # enable = true; + # useNextDns = true; + # nextDnsEnvFile = "/var/run/agenix/nextdns"; + # restrictedMacs = [ + # "5c:e0:c5:8a:24:6a" + # "b4:18:d1:ab:4e:5a" + # ]; + # upstreamDnsServers = [ + # "2a07:a8c1::" + # "45.90.30.0" + # "2a07:a8c0::" + # "45.90.28.0" + # ]; + # externalInterface = "enp1s0"; + # internalInterface = "enp2s0"; + # internalInterfaceIP = "192.168.20.1"; + # dnsMasqSettings.no-resolv = true; + # dnsMasqSettings.bogus-priv = true; + # dnsMasqSettings.strict-order = true; + # }; age.secrets = { ts-google-9k = { diff --git a/configurations/nixos/x86_64-linux/sagittarius.nix b/configurations/nixos/x86_64-linux/sagittarius.nix index da2c0b613..a63819501 100644 --- a/configurations/nixos/x86_64-linux/sagittarius.nix +++ b/configurations/nixos/x86_64-linux/sagittarius.nix @@ -5,7 +5,56 @@ pkgs, lib, ... -}: { +}: +let + # Detect public IPv4 from the WAN interface + getPublicIpv4 = pkgs.writeShellScript "get-public-ipv4" '' + ${pkgs.iproute2}/bin/ip -4 -json addr show dev enp1s0f0 scope global | \ + ${pkgs.jq}/bin/jq -r '.[0].addr_info[0].local // empty' + ''; + + # Generate Jool NAT64 config with detected IP + generateJoolConfig = pkgs.writeShellScript "generate-jool-config" '' + PUBLIC_IP=$(${getPublicIpv4}) + + if [ -z "$PUBLIC_IP" ]; then + echo "ERROR: Could not detect public IPv4 address on enp1s0f0" >&2 + exit 1 + fi + + echo "Configuring Jool NAT64 with public IP: $PUBLIC_IP" >&2 + + # Generate the JSON config with the detected IP + cat > /run/jool-nat64-default.conf <