From 5b35878c31edd9b4c3e1a246a168dfdc3969ebae Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Fri, 5 May 2023 17:30:12 -0500 Subject: [PATCH] Back to dnsmasq --- hosts/mm/default.nix | 19 +++++++++++++------ modules-linux/router.nix | 13 +++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/hosts/mm/default.nix b/hosts/mm/default.nix index e6298a4..7849548 100644 --- a/hosts/mm/default.nix +++ b/hosts/mm/default.nix @@ -26,7 +26,7 @@ in networking = { hostName = "mm"; domain = "mindmazeroom.lan"; - nameservers = [ lanIpAddress ]; + #nameservers = [ "127.0.0.53" ]; interfaces = { "${wanInterface}".useDHCP = true; "${lanInterface}" = { @@ -46,14 +46,21 @@ in # Serves as the router, DHCP, and DNS for the site greg.router = { enable = true; - wan = wanInterface; + wan = [ wanInterface "tailscale0" ]; lan = [ lanInterface ]; }; + greg.tailscale.enable = true; services = { - bind = { - enable = false; - cacheNetworks = [ "127.0.0.1/24" "${lanIpAddress}/24" ]; - listenOn = [ lanInterface ]; + dnsmasq = { + enable = true; + settings = { + domain = "mindmazeroom.lan"; + server = [ + "1.1.1.1" + "100.100.100.100" + "8.8.8.8" + ]; + }; }; create_ap = { enable = false; diff --git a/modules-linux/router.nix b/modules-linux/router.nix index 875494f..1fbf713 100644 --- a/modules-linux/router.nix +++ b/modules-linux/router.nix @@ -7,17 +7,18 @@ let let lanList = names lan; allLan = names (lan ++ limitedLan); - wanName = ''"${wan}"''; + wanName = names wan; in '' table ip filter { chain input { type filter hook input priority 0; policy drop; + iifname lo accept iifname { ${lanList} } accept comment "Allows LAN traffic and outgoing" - iifname ${wanName} ct state { established, related } accept comment "Allows existing connections" - iifname ${wanName} icmp type { echo-request, destination-unreachable, time-exceeded } counter accept comment "Allow some ICMP traffic" - iifname ${wanName} counter drop comment "Drop other incoming traffic, and count how much" + iifname { ${wanName} } ct state { established, related } accept comment "Allows existing connections" + iifname { ${wanName} } icmp type { echo-request, destination-unreachable, time-exceeded } counter accept comment "Allow some ICMP traffic" + iifname { ${wanName} } counter drop comment "Drop other incoming traffic, and count how much" } chain forward { type filter hook forward priority 0; policy drop; @@ -29,7 +30,7 @@ table ip filter { table ip nat { chain postrouting { type nat hook postrouting priority 100; policy accept; - oifname "${wan}" masquerade + oifname { ${wanName} } masquerade } } @@ -48,7 +49,7 @@ in with lib; { options.greg.router = { enable = mkEnableOption "Enable NFTables and routing"; wan = mkOption { - type = types.str; + type = (types.listOf types.str); description = "The name of the network interface that is the WAN connection"; }; lan = mkOption {