I recently switched to NixOS, and everything works well. But no matter how much I try, I can’t configure DNS. In Arch, I just added my DNS to /etc/resolv.conf, but here I have to declare it under networking.nameservers. I did that and also tried multiple other settings, but nothing works. Whenever I run a DNS leak test, I see several Google DNS servers and one or two Cloudflare servers instead of the nameservers I configured.
this DNS server is appearing because I removed dns="none", that allows NetworkManager to edit /etc/resolv.conf, which adds 192.168.1.1 at the top of all of my nameservers in /etc/resolv.conf.
So, I re-added dns="none" and got:
; <<>> DiG 9.20.18 <<>> nixos.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4826
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 4716c6051efd4ea80100000069a151ce3db54dfd540a4da5 (good)
;; QUESTION SECTION:
;nixos.org. IN A
;; ANSWER SECTION:
nixos.org. 1300 IN A 99.83.231.61
nixos.org. 1300 IN A 75.2.60.5
;; Query time: 18 msec
;; SERVER: 1.1.1.3#53(1.1.1.3) (UDP)
;; WHEN: Fri Feb 27 13:41:58 IST 2026
;; MSG SIZE rcvd: 98
As you can see, it’s now using 1.1.1.3 as set. I checked to make sure DoH is off in my browsers and it is set to use dns set on OS but still dnsleaktest shows a bunch of Google servers.