From 7aed3b7e6fd4e4afb74012a70f38c947de95b1ef Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 30 Jan 2023 02:01:30 +0100 Subject: [PATCH] Replace avahi with systemd-resolved --- modules/networking.nix | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/networking.nix b/modules/networking.nix index 5c6dd4d..2f19423 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -22,12 +22,25 @@ in { }; systemd.network.wait-online.enable = false; - # Disable DNSSEC - services.resolved.dnssec = "false"; + # Disable DNSSEC and enable mDNS + services.resolved = { + enable = true; + dnssec = "false"; + llmnr = "false"; + extraConfig = '' + MulticastDNS=yes + ''; + }; # Prioritize ethernet over WiFi - systemd.network.networks."40-enp0s31f6".dhcpV4Config.RouteMetric = 10; - systemd.network.networks."40-wlan0".dhcpV4Config.RouteMetric = 20; + systemd.network.networks."40-enp0s31f6" = { + dhcpV4Config.RouteMetric = 10; + networkConfig.MulticastDNS = "yes"; + }; + systemd.network.networks."40-wlan0" = { + dhcpV4Config.RouteMetric = 20; + networkConfig.MulticastDNS = "yes"; + }; # Static IP for home network systemd.network.networks."24-home" = { @@ -39,13 +52,10 @@ in { address = [ "192.168.13.131/24" ]; gateway = [ "192.168.13.1" ]; dns = [ "192.168.13.2" ]; - networkConfig.DNSSEC = "no"; - }; - - # Enable zeroconf - services.avahi = { - enable = true; - nssmdns = true; + networkConfig = { + DNSSEC = "no"; + MulticastDNS = "yes"; + }; }; # VPN setup @@ -100,6 +110,7 @@ in { ]; allowedUDPPorts = [ 54982 # Calibre Wireless + 5353 # mDNS ]; # Allow wireguard traffic extraCommands = ''