NEXTDNS(1)
π nextdns(1) β the manual, but make it make sense π
okay bestie, sit down, hydrate, because this is User Commands and it's about to be your new favorite daemon. This is the nextdns manual page, and yes I'm about to explain the whole thing to you like we're texting at 2am. π«Ά
β¨ NAME β¨
nextdns β a DNS-over-HTTPS proxy client for NextDNS and other DoH providers. π
π SYNOPSIS π
nextdns command [options]
π¦ DESCRIPTION π¦
okay so. nextdns is a daemon. A daemon, bestie. It's a local DNS proxy, and it's literally the main character of your network stack. π
Here's the vibe: it catches standard DNS queries from your system on port 53 (both UDP and TCP, she's versatile π ) and forwards them encrypted over HTTPS β that's DNS-over-HTTPS, DoH for short, iykyk β over to NextDNS servers or literally any other DoH provider you want. no cap.
The gorgeous part? Apps on your system need zero changes. They keep speaking plain, boring DNS to localhost like nothing happened, and nextdns quietly handles encryption, caching, filtering and logging behind the scenes. it's giving invisible guardian angel. β¨
The fancy filtering + analytics stuff requires a NextDNS account and a profile ID, which you get at https://nextdns.io. But also, lowkey, you can just use the daemon as a plain DoH client for any compatible provider. versatile queen. π
π QUICK START π
Step 1: Create a NextDNS account and grab your Profile ID:
https://nextdns.io
Step 2: Configure NextDNS before you start the service:
sudo nextdns config set -profile <profile-id>
Or, if you're feeling hands-on, edit the config file directly:
sudo editor /etc/nextdns.conf
Step 3: Enable and start the service:
sudo systemctl enable --now nextdns
Step 4: Verify the service is actually running (vibe check π):
nextdns status
systemctl status nextdns
Step 5: Test DNS resolution through NextDNS:
dig @127.0.0.1 debian.org
if that resolves you ATE. π
π COMMANDS π
here's the whole menu, babes:
install [options]β Not supported on Debian systems. π The service is managed by the package manager instead. To enable and start the service, use:
sudo systemctl enable --now nextdns
uninstallβ Not supported on Debian systems. π To remove the package, use:
sudo apt remove nextdns
startβ Start the installed service. πstopβ Stop the running service. πrestartβ Restart the running service. πstatusβ Print the current service status (that's running, stopped, or not installed). πlogβ Display the service logs. πrun [options]β Run the DNS proxy daemon in the foreground. Perfect for testing, or for environments where there's no service manager to handle things. See RUN OPTIONS below. πconfig listβ List all current configuration options and their values. πconfig set [options]β Set one or more configuration options persistently. It accepts the exact same flags asrun. Runnextdns config set -hfor the full list. π§config editβ Open the configuration file in your default editor. βοΈconfig wizardβ Run an interactive configuration wizard. π§ (magical)activateβ Configure the local system to usenextdnsas its DNS resolver (writes to/etc/resolv.confor configuressystemd-resolved). πdeactivateβ Restore the original system DNS configuration. β©οΈdiscoveredβ Display the list of clients discovered on the local network via ARP, NDP, mDNS and DHCP, along with their resolved names and addresses. π΅οΈβοΈcache-statsβ Display hit/miss statistics for the local DNS cache. π―cache-keysβ Dump the list of domain names currently held in the local cache. ποΈtraceβ Print a full goroutine stack trace of the running daemon. Super useful for debugging hangs or unexpected behaviour. π§΅arpβ Dump the current ARP table (that's IPv4 address to MAC address mappings). πndpβ Dump the current NDP table (IPv6 address to MAC address mappings). πupgradeβ Not supported on Debian systems. π To upgrade, use:
sudo apt update && sudo apt install nextdns
versionβ Print the current version string. π·οΈ
π₯ RUN OPTIONS π₯
These are all the options that run accepts. Buckle up, there's a lot, and they're all important, so no skipping. π«‘
-profile IDβ Your NextDNS profile ID (6 hexadecimal characters, e.g.ab12cd). The profile decides which filtering rules, blocklists and analytics apply to queries. This option may be repeated with a condition prefix to pick different profiles based on source subnet, MAC address, interface or user:10.0.3.0/24=abcdefβ Apply profileabcdefto queries from the given IPv4 CIDR.2001:db8::/32=abcdefβ Apply profile to queries from the given IPv6 CIDR.00:1c:42:2e:60:4a=abcdefβ Apply profile to the host with the given MAC address.eth0=abcdefβ Apply profile to all hosts reachable through the given interface.@alice=abcdefβ On Linux (systemd-logind), macOS and Windows, apply profile when the interactive user isalice.
The first matching rule wins. periodt. π
-listen addrβ Address and port to listen on for DNS queries. May be repeated to listen on multiple addresses. Default:localhost:53. Example:0.0.0.0:53. π‘-setup-routerβ Configurenextdnsfor router mode: listen on all interfaces, set up DNS forwarding rules for the detected router type (OpenWrt, DD-WRT, EdgeOS, etc.) and undo all changes on exit. Heads up: when this option is active, the-listenoption is ignored. π-auto-activateβ Automatically runactivateat startup anddeactivateon exit, updating the system resolver configuration. π-cache-size sizeβ Size of the in-memory DNS cache. Accepts units:kB,MB,GB. Set it to0to disable caching (that's the default). Example:10MB. πΎ-cache-max-age durationβ Maximum age for cached entries regardless of their TTL. Example:1h. β³-cache-metricsβ Enable collection of cache hit/miss metrics, accessible viacache-stats. π-max-ttl durationβ Cap the TTL returned to clients. The internal cache still uses the true TTL for freshness evaluation. Useful together with-cache-sizeto make profile changes propagate faster to LAN clients. β‘-forwarder [domain=]addr[,addr...]β Forward queries for domain to the specified DNS server instead of NextDNS. If no domain is given, the forwarder acts as a catch-all fallback. May be repeated; first match wins. addr may be anIP[:port]for plain DNS or an HTTPS URL for DoH. A bootstrap IP may be appended after#for DoH addresses. Example:-forwarder corp.example.com=192.168.1.1. π-report-client-infoβ Attach device name, model and a short non-reversible ID to each query sent upstream. This enables per-device analytics in the NextDNS dashboard. π-discovery-dns addrβ DNS server used to resolve client names from IP addresses in router mode. Defaults to the server learned via DHCP. Only active when-report-client-infois set. π-mdns all|disabled|interfaceβ Control mDNS-based client discovery. Useall(default) to listen on all interfaces, an interface name to restrict discovery, ordisabledto turn it off entirely. πΆ-bogus-privβ Answer reverse lookups for private IP ranges (RFC 1918, RFC 4193) withNXDOMAINinstead of forwarding them upstream. Enabled by default. π‘οΈ-detect-captive-portalsβ Fall back to plain DNS when a captive portal is detected, so the initial connection can succeed. Disabled by default. β οΈ Warning: enabling this option may allow an attacker to force unencrypted DNS traffic. stay safe out there bestie.-timeout durationβ Maximum time to wait for an upstream response before failing. Default:5s. β°-max-inflight-requests nβ Maximum number of concurrent in-flight requests. Default:256. π¦-control pathβ Path to the Unix domain socket used by control commands (cache-stats,trace,arp, etc.). Default:/var/run/nextdns.sock. π-log-queriesβ Log every DNS query and its result to the system logger. π-use-hostsβ Consult/etc/hostsbefore sending queries upstream. Enabled by default. π-debugβ Enable verbose debug logging. π-config-file pathβ Path to an alternative configuration file. ποΈ
π« EXAMPLES π«
πΌ Getting started
Create a free account at https://nextdns.io and note your Profile ID (a 6-character hex string, e.g. ab12cd). Then configure and start the service:
# Set your profile
sudo nextdns config set -profile ab12cd
# Enable and start the service
sudo systemctl enable --now nextdns
# (Optional) Redirect system DNS to NextDNS
sudo nextdns activate
Check that the service is running:
nextdns status
π§ͺ Running in the foreground (testing)
Run the daemon interactively on a non-standard port, with caching and query logging enabled. This is chef's kiss for verifying behaviour before you commit to a permanent configuration:
sudo nextdns run -profile ab12cd -listen localhost:5454 \
-cache-size 10MB -log-queries
In a second terminal, send a query and observe the response:
dig @127.0.0.1 -p 5454 example.com A
Repeat the same query to verify the cache is working β the query time should drop to 0 ms on the second and subsequent calls:
dig @127.0.0.1 -p 5454 example.com A # first: ~300 ms (upstream)
dig @127.0.0.1 -p 5454 example.com A # second: ~0 ms (cache hit)
π Inspecting the cache
After the daemon has been running for a while (started with -cache-size), check how many queries were served from the local cache versus forwarded upstream:
nextdns cache-stats
Example output:
{
"hit": 5,
"miss": 11
}
To also collect detailed metrics (hits ratio, keys added/updated, etc.), start the daemon with both -cache-size and -cache-metrics:
sudo nextdns run -profile ab12cd -cache-size 10MB -cache-metrics
Then retrieve the extended counters at any time:
nextdns cache-metrics
β±οΈ Controlling TTL handed to clients
Cap the TTL returned to LAN clients at 5 seconds so they always re-query the daemon (and pick up profile changes immediately) rather than caching answers themselves. The daemon's internal cache still honours the true TTL:
sudo nextdns run -profile ab12cd -cache-size 10MB -max-ttl 5s
π« bogus-priv: blocking private reverse lookups
By default, -bogus-priv is enabled. Reverse lookups for private IP ranges (RFC 1918, RFC 4193) are answered locally with NXDOMAIN and never forwarded upstream:
# returns NXDOMAIN immediately β not forwarded to NextDNS
dig @127.0.0.1 -p 5454 -x 192.168.1.1
# public IP β forwarded and resolved normally
dig @127.0.0.1 -p 5454 -x 8.8.8.8
To disable this behaviour (forward all reverse lookups upstream):
sudo nextdns run -profile ab12cd -bogus-priv=false
πΈ use-hosts: resolving /etc/hosts entries π
So with -use-hosts (which is on by default, bestie, you don't have to do anything), any query for a name that lives in /etc/hosts gets answered locally before anyone even thinks about going upstream. It's giving instant gratification.
Drop a local entry in like this:
# Add a local entry
echo '10.0.0.10 myserver.home' | sudo tee -a /etc/hosts
And then watch it get resolved instantly from /etc/hosts β 0 ms, zero upstream query, no cap:
# Resolved instantly from /etc/hosts, 0 ms, no upstream query
dig @127.0.0.1 -p 5454 myserver.home A
π¦ Split-horizon DNS with forwarders
Okay so you've got an internal corporate domain and you want that going to an on-premises DNS server while everything else goes to NextDNS. Very demure, very mindful:
sudo nextdns config set -profile ab12cd \
-forwarder corp.example.com=192.168.1.1
sudo systemctl restart nextdns
Now say you want a DoH forwarder with a bootstrap IP for one specific domain. The bootstrap address is there to dodge that whole chicken-and-egg β¨situationβ¨ where the DoH hostname itself still needs to be resolved:
sudo nextdns config set -profile ab12cd \
-forwarder internal.lan=https://doh.company.com#10.0.0.1
sudo systemctl restart nextdns
And listen β multiple forwarders get evaluated in order, and the first matching rule wins. Periodt:
sudo nextdns config set -profile ab12cd \
-forwarder corp.example.com=192.168.1.1 \
-forwarder lab.example.com=192.168.2.1
sudo systemctl restart nextdns
π Using public DoH providers as forwarders
NextDNS can forward queries for specific domains to any public DNS-over-HTTPS resolver. The general format goes like this, bestie:
-forwarder DOMAIN=https://PROVIDER/dns-query
Here are the well-known public providers it supports β I'm putting the whole table in bullet form because tables are not the vibe here, but every single one is accounted for π
- Cloudflare (1.1.1.1) β
https://cloudflare-dns.com/dns-queryβ No IP logs - Cloudflare + malware β
https://security.cloudflare-dns.com/dns-queryβ Blocks malware and phishing - Google (8.8.8.8) β
https://dns.google/dns-queryβ High availability - Quad9 (9.9.9.9) β
https://dns.quad9.net/dns-queryβ Blocks malware + DNSSEC + no logs - AdGuard β
https://dns.adguard-dns.com/dns-queryβ Blocks ads and trackers - AdGuard Family β
https://family.adguard-dns.com/dns-queryβ Ads + adult content blocked - Mullvad β
https://dns.mullvad.net/dns-queryβ Strict no-logs policy - OpenDNS β
https://doh.opendns.com/dns-queryβ Cisco-backed
Forward example.com to Cloudflare and literally everything else to NextDNS:
sudo nextdns run -profile ab12cd \
-forwarder example.com=https://cloudflare-dns.com/dns-query
Forward different domains to different providers at the same time, because why would you pick just one:
sudo nextdns run -profile ab12cd \
-forwarder work.example.com=https://dns.google/dns-query \
-forwarder games.example.com=https://dns.quad9.net/dns-query
Route all queries through a single public DoH provider with a wildcard rule, bypassing NextDNS entirely (main character energy, honestly):
sudo nextdns run -forwarder .=https://dns.quad9.net/dns-query
Add a bootstrap IP so you don't get stuck in circular resolution when the DoH hostname isn't reachable yet:
sudo nextdns run -profile ab12cd \
-forwarder example.com=https://cloudflare-dns.com/dns-query#1.1.1.1
Define multiple servers for one domain to implement failover β they get tried left to right:
sudo nextdns run -profile ab12cd \
-forwarder example.com=https://dns.quad9.net/dns-query,https://dns.google/dns-query
π«Ά Wanna check the forwarder is actually active? Query the NextDNS metadata endpoint from a second terminal while the daemon is running. Theprotofield should readDOH.
dig @127.0.0.1 whoami.cloudflare TXT CH
The ADDITIONAL SECTION of that response is stuffed with metadata injected by the NextDNS daemon itself, and it's lowkey iconic:
profile.nextdns.io. 0 CH TXT "default"
client.nextdns.io. 0 CH TXT "203.0.113.10"
proto.nextdns.io. 0 CH TXT "DOH"
server.nextdns.io. 0 CH TXT "edgeuno-for-1"
π Per-device profiles (router mode)
Set it up as a router serving the whole LAN, with device-name discovery and per-device profile assignment by subnet:
sudo nextdns config set \
-profile 10.0.1.0/24=ab12cd \
-profile 10.0.2.0/24=ef34gh \
-setup-router \
-report-client-info
sudo systemctl enable --now nextdns
Assign a specific profile to a single device by MAC address:
sudo nextdns config set -profile ab12cd \
-profile 00:1c:42:2e:60:4a=ef34gh \
-setup-router -report-client-info
sudo systemctl restart nextdns
On Linux with systemd-logind, you can assign a profile per interactive user:
sudo nextdns config set \
-profile @alice=ab12cd \
-profile @bob=ef34gh
sudo systemctl restart nextdns
And to peek at the devices discovered on the LAN (that's ARP, NDP, mDNS and DHCP doing the work):
nextdns discovered
π©Ί Diagnostics
Show the ARP table (IPv4 address β MAC mappings):
nextdns arp
Show the NDP table (IPv6 address β MAC mappings):
nextdns ndp
Print a goroutine stack trace of the running daemon β super useful when the daemon looks hung and you're like π:
nextdns trace
Follow the live service logs:
nextdns log
π Managing the configuration file
List the current persistent configuration:
nextdns config list
Persistently enable caching and client reporting without reinstalling (we love a no-drama update):
sudo nextdns config set -cache-size 10MB -report-client-info
sudo nextdns restart
Open the configuration file in the default editor:
sudo nextdns config edit
β¨ FILES β¨
/etc/nextdns.confβ the default configuration file, managed bynextdns config./var/run/nextdns.sockβ the Unix domain control socket used forcache-stats,cache-keys,discovered,traceand similar commands.
π SEE ALSO π
systemctl(1), resolv.conf(5), dig(1)
NextDNS documentation and profile management: https://nextdns.io
πΈ AUTHOR πΈ
NextDNS Inc. <support@nextdns.io>
This manual page was written for the Debian package by Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>.
And that's the whole page, bestie β no crumbs left π
This one's from nextdns, dated 2026-06-02, and it's NEXTDNS(1) all the way down. Go forth and resolve responsibly π¦β¨
π¦ where this page comes from
- ubuntu stonking: nextdns 1.47.3+ds-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms