Set up SecDNS on a UniFi Dream Machine
The UniFi Dream Machine (UDM, UDM Pro and UDM SE) does not ship with a native DoH or DoT client, but you can still force every device on the LAN through SecDNS by setting custom DHCP DNS and intercepting port 53. The whole setup takes about fifteen minutes.
What you will need
- A SecDNS account
- A UniFi Dream Machine running UniFi Network 8.0 or newer
- Admin access to the UniFi web UI
- The SecDNS anycast resolver IP and the DoH URL
https://dns.secdns.io/dns-query/<device-id>
Setup steps
- Create a device in SecDNS. Sign in, open Devices and add a new UniFi device. Copy the anycast IP shown on the device detail page. [screenshot placeholder]
- Open Network settings. Sign in to UniFi Network. Go to Settings, Networks and pick the LAN you want to protect. [screenshot placeholder]
- Set DNS Server entries. Expand DHCP Service Management. In DHCP Name Server switch the toggle to Manual and enter the SecDNS anycast IP as the primary DNS server. Leave the secondary blank to avoid leaking.
- Apply and renew clients. Click Apply Changes. Existing clients keep the old DNS until their lease renews. From a test client run
ipconfig /renew(Windows) orsudo dhclient -r && sudo dhclient(Linux). - Add a port 53 redirect (optional). Settings, Routing, Port Forwarding lets you redirect outbound UDP/TCP 53 from the LAN back to the UDM. This blocks devices that hardcode public DNS (some smart TVs and IoT devices).
- Test from a client. Visit https://dnscheck.tools or run
dig +short whoami.cloudflare TXT. The resolver hostname should report SecDNS infrastructure.
Verify it works
On a Mac or PC run ipconfig /all (Windows) or scutil --dns (macOS) and confirm the DNS server matches the SecDNS anycast IP. From https://dnscheck.tools the upstream resolver should be SecDNS. The SecDNS dashboard Live Logs panel fills within seconds.
Troubleshooting
- Clients still use Google or Cloudflare DNS. Some devices (Chromecast, Echo, smart TVs) hardcode 8.8.8.8 or 1.1.1.1. Enable the optional port 53 redirect rule above.
- No internet after the change. Confirm the SecDNS IP is reachable from the UDM by running ping from the SSH console. If port 53 is filtered upstream, switch to the alternate anycast IP listed on the device detail page.
- UniFi Talk drops calls. Verify SecDNS is not blocking
ui.comorunifi.ui.com. Both are required for Talk and Protect. - IPv6 leaks. Pure DHCP DNS only sets IPv4. Also configure RDNSS in Settings, Networks, IPv6 so clients get the SecDNS IPv6 anycast address.
Notes
UDM Pro users can install AdGuard Home or unbound through UniFi OS containers (UDM-Pro 3.0+ supports unifi-os shell). That lets you do DoT or DoH upstream to SecDNS rather than plain UDP/53.