diff --git a/shared/commons/resolver.nix b/shared/commons/resolver.nix index 5cdada1..7aa95aa 100644 --- a/shared/commons/resolver.nix +++ b/shared/commons/resolver.nix @@ -1,12 +1,8 @@ -{ ... }: +{ config, ... }: let # Import nodes nodes = import ./../../nodes.nix; - myName = config.hostName; - myPeer = nodes."${myName}"; - myId = myPeer.id; - myZone = myPeer.zone; # Import mapping mapping = import ./../../mapping.nix; @@ -28,6 +24,7 @@ in services.dnsmasq = { enable = true; settings = { + bind-interfaces = true; listen-address = [ "::1" "127.0.0.1" @@ -39,8 +36,8 @@ in "1.1.1.1" "8.8.8.8" "9.9.9.9" - ] ++ map (hostName: "/lf/172.19.${nodes.${hostName}.zone}.${nodes.${hostName}.id}") mapping.dns.hosts - ++ map (hostName: "/lf/fc00::${nodes.${hostName}.zone}:${nodes.${hostName}.id}") mapping.dns.hosts; + ] ++ map (hostName: "/lf/172.19.${toString nodes.${hostName}.zone}.${toString nodes.${hostName}.id}") mapping.dns.hosts + ++ map (hostName: "/lf/fc00::${toString nodes.${hostName}.zone}:${toString nodes.${hostName}.id}") mapping.dns.hosts; no-resolv = true; # Resolvconf can auto-generated /etc/dnsmasq-{conf,resolv}.conf # By default dnsmasq import them diff --git a/shared/dns/knot.nix b/shared/dns/knot.nix index faacbbf..2795d41 100644 --- a/shared/dns/knot.nix +++ b/shared/dns/knot.nix @@ -180,12 +180,6 @@ in "f /var/lib/knot/zones/zone-lasuite-federez-net 0644 knot knot -" ]; - # Knot messes with resolvd - services.resolved.enable = false; - networking.resolvconf.extraConfig = '' - name_servers="1.1.1.1 1.0.0.1 2606:4700:4700::1111" - ''; - # Attach knot to writeZoneFile to force knot to restart after rebuild (otherwise no changes will be detected) systemd.services.knot = { partOf = [ "writeZoneFile.service" ]; @@ -205,10 +199,13 @@ in settings = { server = { - listen = [ - "0.0.0.0@53" - "::@53" - ]; + listen = + [ + "172.19.${toString myNode.zone}.${toString myNode.id}@53" + "fc00::${toString myNode.zone}:${toString myNode.id}@53" + ] + ++ lib.optional (supportsIPv4 myNode) "${rmCidr myNode.ip4}@53" + ++ lib.optional (supportsIPv6 myNode) "${rmCidr myNode.ip6}@53"; }; remote = remotes;