diff --git a/roles/server/default.nix b/roles/server/default.nix index af9c11a..5d6a6b8 100755 --- a/roles/server/default.nix +++ b/roles/server/default.nix @@ -15,5 +15,6 @@ ./tailscale.nix ./traefik.nix ./minecraft.nix + ./dns.nix ]; } diff --git a/roles/server/dns.nix b/roles/server/dns.nix new file mode 100644 index 0000000..c5915d2 --- /dev/null +++ b/roles/server/dns.nix @@ -0,0 +1,40 @@ +{ ... }: + +{ + services.dnsmasq = { + enable = true; + + # Only using this for tailscale IPs, so better to let tailscale itself deal with it + resolveLocalQueries = false; + + settings = { + listen-address = [ "100.73.96.48" ]; + + /* + Dnsmasq tries to use the tailscale dns server, which is bad cause that points to dnsmasq + From the little testing I have done it seems to not cause any issues, but better to be safe + than sorry :P + */ + dns-loop-detect = true; + ## IPv6 is not a thing in Spain so I'm guaranteed to not use it + filter-AAAA = true; + expand-hosts = true; + domain = "sable-pancake.ts.net"; + domain-needed = true; + }; + }; + + # Add tailscale hosts + networking.hosts = { + "100.73.96.48" = [ "everest" ]; + "100.113.139.93" = [ "archie" ]; + "100.85.48.85" = [ "steamdeck" ]; + "100.96.92.13" = [ "surfecego" ]; + }; + + # Dnsmasq conflicts with the resolved dns stub listener + services.resolved.extraConfig = '' + [Resolve] + DNSStubListener=no + ''; +}