From 601129bb48dbb6e0dfa765ad2bdbc3925224aa9d Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 29 Aug 2024 18:02:04 -0700 Subject: [PATCH] Get mDNS through avahi and resolved working. First off, we need port 5353 because that's where mDNS does its thing. It's like DNS and port 53, but doubled, right? Next, we have to enable MulticastDNS for the network in question, specifically the "wan" interface. Finally, we add avahi which ... does... stuff. --- quinn/etc/nixos/configuration.nix | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/quinn/etc/nixos/configuration.nix b/quinn/etc/nixos/configuration.nix index 7a46979..f9e2e40 100644 --- a/quinn/etc/nixos/configuration.nix +++ b/quinn/etc/nixos/configuration.nix @@ -145,6 +145,20 @@ # List services that you want to enable: + services.avahi = { + enable = true; + ipv6 = true; + ipv4 = true; + nssmdns4 = true; + nssmdns6 = true; + publish = { + addresses = true; + enable = true; + hinfo = true; + }; + }; + + services.nginx = { enable = true; virtualHosts."pihole.home.arpa" = { @@ -200,7 +214,7 @@ # Enable the OpenSSH daemon. services.openssh.enable = true; - # Disable the resolved stub listener, let Pihole do it + # Disable the resolved stub listener, let Pihole bind port 53 on all interfaces. services.resolved = { extraConfig = '' DNSStubListener=no @@ -241,8 +255,8 @@ networking.firewall = { enable = false; allowPing = true; - allowedTCPPorts = [ 80 443 ]; - allowedUDPPortRanges = [ + allowedTCPPorts = [ 80 443 5353 ]; + allowedUDPPortRanges = [ 5353 #{ from = 4000; to = 4007; } #{ from = 8000; to = 8010; } ]; @@ -288,6 +302,8 @@ DHCP = "ipv4"; # accept Router Advertisements for Stateless IPv6 Autoconfiguraton (SLAAC) IPv6AcceptRA = true; + # Allow mDNS .local address resolution + MulticastDNS = true; }; addresses = [{ addressConfig = {