fix overlapping bind addr for dnsmasq and knot

This commit is contained in:
asyncnomi 2025-07-27 01:51:22 +02:00
parent b46c2a8355
commit 60ed09d608
2 changed files with 11 additions and 17 deletions

View file

@ -1,12 +1,8 @@
{ ... }: { config, ... }:
let let
# Import nodes # Import nodes
nodes = import ./../../nodes.nix; nodes = import ./../../nodes.nix;
myName = config.hostName;
myPeer = nodes."${myName}";
myId = myPeer.id;
myZone = myPeer.zone;
# Import mapping # Import mapping
mapping = import ./../../mapping.nix; mapping = import ./../../mapping.nix;
@ -28,6 +24,7 @@ in
services.dnsmasq = { services.dnsmasq = {
enable = true; enable = true;
settings = { settings = {
bind-interfaces = true;
listen-address = [ listen-address = [
"::1" "::1"
"127.0.0.1" "127.0.0.1"
@ -39,8 +36,8 @@ in
"1.1.1.1" "1.1.1.1"
"8.8.8.8" "8.8.8.8"
"9.9.9.9" "9.9.9.9"
] ++ map (hostName: "/lf/172.19.${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::${nodes.${hostName}.zone}:${nodes.${hostName}.id}") mapping.dns.hosts; ++ map (hostName: "/lf/fc00::${toString nodes.${hostName}.zone}:${toString nodes.${hostName}.id}") mapping.dns.hosts;
no-resolv = true; no-resolv = true;
# Resolvconf can auto-generated /etc/dnsmasq-{conf,resolv}.conf # Resolvconf can auto-generated /etc/dnsmasq-{conf,resolv}.conf
# By default dnsmasq import them # By default dnsmasq import them

View file

@ -180,12 +180,6 @@ in
"f /var/lib/knot/zones/zone-lasuite-federez-net 0644 knot knot -" "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) # Attach knot to writeZoneFile to force knot to restart after rebuild (otherwise no changes will be detected)
systemd.services.knot = { systemd.services.knot = {
partOf = [ "writeZoneFile.service" ]; partOf = [ "writeZoneFile.service" ];
@ -205,10 +199,13 @@ in
settings = { settings = {
server = { server = {
listen = [ listen =
"0.0.0.0@53" [
"::@53" "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; remote = remotes;