What is DNS security?
DNS security covers everything that keeps name lookups honest and available, from the registrar account that owns a domain to the resolver a server uses.
What can go wrong with DNS?
Four broad things: someone changes your records, someone forges answers, someone watches your queries, or someone knocks the service offline. Each has its own defence, and a sound setup uses several at once.
| Threat | Example | Main defence |
|---|---|---|
| Account takeover | Attacker logs into the registrar and changes name servers | Strong login, two-factor, registry lock |
| Forged answers | Cache poisoning, on-path tampering | DNSSEC validation, source port randomisation |
| Snooping | Queries read on public Wi-Fi or transit | DNS over TLS, DNS over HTTPS |
| Denial of service | Flood against authoritative servers | Anycast, several providers, filtering |
| Abuse of your resolver | Open resolver used for amplification | Restrict recursion to your own clients |
Where does DNS security start?
At the registrar. The most damaging DNS incidents are not clever protocol attacks but someone logging into the account that controls a domain and pointing it elsewhere. Use a unique password and two-factor authentication, keep contact email on a different domain, enable transfer lock, and for critical domains ask the registry for a registry lock that requires manual confirmation before changes. Audit who has access at least once a year.
What does DNSSEC protect?
The integrity of answers. A signed zone carries cryptographic signatures on its records, and validating resolvers check them along a chain of trust from the root. A forged answer fails validation and is discarded, which blocks cache poisoning outright. DNSSEC does not encrypt anything and does not stop a registrar account takeover. Most registrars and DNS hosts can sign zones automatically; check the result from any server:
delv @9.9.9.9 example.net A +rtrace dig +dnssec +multi example.net DNSKEY dig example.net DS +short
A fully validated line from delv confirms the chain is intact.
How do DNS over TLS and DNS over HTTPS help?
They encrypt queries between a client and its resolver, so networks in between cannot read or alter them. DNS over TLS uses port 853, DNS over HTTPS hides queries among web traffic on port 443. On a server, systemd-resolved can use DNS over TLS to an upstream resolver with two lines in /etc/systemd/resolved.conf:
[Resolve] DNS=9.9.9.9#dns.quad9.net 2620:fe::fe#dns.quad9.net DNSOverTLS=yes
Encryption to the resolver complements DNSSEC; one hides queries, the other proves answers genuine.
How should I run my own resolver safely?
Answer recursive queries only for your own machines. An open resolver reachable from the internet will be found within days and used to amplify attacks against others, which is both harmful and a breach of acceptable use. In Unbound, bind to localhost or your WireGuard interface and set access-control to those ranges only. Enable DNSSEC validation, keep harden-glue and harden-dnssec-stripped on, and keep the software patched. Our DNS root servers article shows a related Unbound option.
Can I host authoritative DNS on a dedicated server?
Yes. Software such as Knot DNS, NSD, PowerDNS or BIND serves zones efficiently on modest hardware. Since each server includes one IPv4 address and DDoS filtering, a pair of machines in different data centres, for instance Roubaix and Toronto, makes a robust primary and secondary. Many operators combine their own servers with a second DNS provider, so a problem with one never takes the domain offline. Allow zone transfers only to known secondaries and sign them with TSIG keys.
Which records reduce email spoofing?
SPF, DKIM and DMARC, all published in DNS. SPF lists the servers allowed to send mail for your domain, DKIM publishes a public key that receivers use to verify message signatures, and DMARC tells receivers what to do when both checks fail and where to send reports. A domain that never sends mail should still publish a strict SPF record and a reject policy. Our Mail server deliverability guide shows the records for a mail server.
How do I spot DNS problems early?
Monitor from outside. Check from several networks that your names resolve to the right addresses, that DNSSEC validates and that signatures are not near expiry. Alert on any unexpected change to name server or DS records at the registry, which is the fingerprint of an account takeover. Our DNS attacks article lists attack types to watch for and DNS poisoning covers cache poisoning in depth.
Related pages
How DNS works
From a typed name to an IP address: resolvers, root and TLD servers, authoritative zones, record types, TTLs and caching, with the commands to watch it happen.
Read moreDNS poisoning
How forged DNS answers send users to the wrong server, cache poisoning against hijacking, DNSSEC validation, resolver hardening and protecting your domains.
Read moreDNS root servers
The thirteen named root server identities, the anycast instances behind them, how resolvers use them and why the root rarely sees your queries.
Read moreMail server deliverability
Keep mail from your own server out of spam folders: DNS records, reverse DNS, sending limits and a clean outbound path.
Read moreQuestions and answers
Does DNSSEC encrypt DNS traffic?
No. DNSSEC signs records so forged answers can be detected. Encryption of queries comes from DNS over TLS or DNS over HTTPS.
What is the biggest DNS risk for most domain owners?
A takeover of the registrar account. Two-factor authentication, transfer lock and a registry lock for important domains reduce it greatly.
Why should a resolver not be open to the internet?
Open resolvers are abused to amplify denial of service attacks against others. Limit recursion to your own servers and networks.
Can I run authoritative DNS on a dedicated server?
Yes. Knot DNS, NSD, PowerDNS or BIND run well on modest hardware. Use two servers in different locations, or combine one with a second DNS provider.
Which DNS records stop people spoofing my domain in email?
SPF, DKIM and DMARC. Together they tell receiving servers which senders are genuine and what to do with messages that fail the checks.