DNS
DNS port guide: name resolution on port 53
Understand how DNS uses UDP and TCP 53, when a DNS server should be reachable, how to test lookups, and how to avoid resolver abuse.
- Default port
- 53
- Protocol
- UDP / TCP
- Primary use
- Domain name resolution
What is the DNS port?
DNS, or Domain Name System, translates names such as example.com into IP addresses and other records. Standard DNS uses port 53 over UDP for most lookups and port 53 over TCP for larger responses, zone transfers, retries, and some operational cases.
DNS uses UDP and TCP port 53
UDP 53 handles most ordinary queries because it is fast and lightweight. TCP 53 is also part of DNS and should not be forgotten in firewall planning.
Authoritative and recursive DNS are different
Authoritative servers answer for your zones, while recursive resolvers look up names for clients. They have different exposure and abuse risks.
How DNS works
When a client needs to reach a domain, it asks a resolver for records such as A, AAAA, CNAME, MX, TXT, NS, or SRV. The resolver may answer from cache or walk the DNS hierarchy through root, TLD, and authoritative servers until it finds the record.
Most client queries use UDP port 53 because the request and response are small. DNS can switch to TCP when responses are too large, when truncation occurs, when DNSSEC increases response size, or when servers perform zone transfers and other operations that require a reliable stream.
UDP 53 vs TCP 53
UDP 53 is the common path for everyday DNS resolution. Blocking it usually breaks normal lookups. TCP 53 is not optional for a complete DNS deployment: it supports large answers, fallback from truncated UDP responses, DNSSEC-heavy responses, and zone transfers between authorized servers.
A firewall rule that allows UDP 53 but blocks TCP 53 can create intermittent failures that are hard to diagnose. Small records may work while larger DNSSEC, TXT, or mail-related responses fail.
Authoritative DNS vs recursive resolvers
An authoritative DNS server publishes records for domains you control. It should be reachable by the internet when it serves public zones, but it should only answer authoritatively for those zones and should not provide open recursion.
A recursive resolver performs lookups for clients. Public recursive resolvers must be designed and protected for that role. Internal resolvers should usually answer only for trusted networks, VPN clients, or specific application environments.
When port 53 should be open
Open port 53 to the internet for authoritative DNS servers that host public zones. Both UDP and TCP should be considered. If the server is internal only, restrict access to the networks that need name resolution.
Do not expose a recursive resolver to the whole internet unless you intentionally operate a public resolver with rate limiting, abuse monitoring, and capacity planning. Open resolvers are commonly abused for reflection and amplification attacks.
Before opening DNS
Before allowing port 53, decide whether the server is authoritative, recursive, forwarding, caching, or split-horizon. Confirm which clients should use it, which zones it serves, whether recursion is enabled, and whether zone transfers are restricted to authorized secondary servers.
A port checker can confirm that port 53 is reachable, but DNS correctness requires protocol-level tests. Use dig, nslookup, drill, or resolver logs to verify record answers, recursion policy, TCP fallback, DNSSEC behavior, and response times.
How to run DNS on Windows, Linux, and cloud platforms
On Windows Server, the DNS Server role can serve Active Directory-integrated zones, internal records, and forwarding rules. Restrict recursion and zone transfers carefully, especially if the server has any public interface.
On Linux, common DNS servers include BIND, Unbound, PowerDNS, Knot DNS, CoreDNS, and dnsmasq. Configure listening interfaces, recursion policy, allowed clients, authoritative zones, logging, and firewall rules for UDP and TCP 53.
On cloud platforms, managed DNS is often safer for public authoritative zones because the provider handles anycast, scaling, and baseline DDoS resilience. Self-hosted DNS still needs redundant instances, monitoring, and clear network policy.
- Service layer: the DNS daemon or managed service must listen on UDP and, where needed, TCP port 53.
- Policy layer: recursion, forwarding, zone transfers, DNSSEC, and split-horizon behavior must match the server role.
- Network layer: host firewalls, cloud security groups, routers, load balancers, and anycast paths must allow intended clients.
- Abuse layer: rate limiting, response size controls, logging, and monitoring help reduce amplification and open-resolver risk.
How to test DNS port 53
Start with an external port check for UDP or TCP 53, depending on what you need to validate. Then run dig @server example.com A, dig @server example.com AAAA, or nslookup against the target resolver to confirm real DNS answers.
Test TCP explicitly with dig +tcp @server example.com TXT or another large response. For authoritative servers, query records from outside your network and verify that recursion is refused. For recursive resolvers, query from both allowed and disallowed source networks.
Common DNS troubleshooting cases
If port 53 is closed, the DNS service may be stopped, listening on the wrong interface, blocked by a host firewall, or restricted by a cloud security group. If UDP appears unreliable but TCP works, inspect MTU, fragmentation, response size, EDNS settings, and DNSSEC-related behavior.
If the port is open but lookups fail, check zone data, delegation, glue records, SOA and NS records, recursion policy, forwarders, DNSSEC validation, cache state, and logs. DNS failures often come from policy or zone configuration rather than raw port reachability.
Security checklist for DNS
Do not run an open recursive resolver by accident. Limit recursion to trusted clients, restrict zone transfers to known secondary servers, keep DNS software patched, and monitor query rates, NXDOMAIN spikes, SERVFAIL spikes, and unusual source networks.
For public authoritative DNS, use redundant servers, DNSSEC where appropriate, short enough TTLs for operational flexibility, and clear ownership of zone changes. For internal DNS, protect split-horizon records because they often reveal infrastructure names and private topology.
Frequently asked questions
What port does DNS use?
DNS uses port 53. Most normal queries use UDP 53, while TCP 53 is used for larger responses, truncated UDP fallback, zone transfers, and other reliable-stream cases.
Do I need to open both UDP and TCP 53?
Often yes. UDP 53 handles most lookups, but TCP 53 is part of DNS and is needed for large answers, DNSSEC-heavy responses, and zone transfers. Blocking TCP can cause intermittent DNS failures.
Is an open DNS port dangerous?
An authoritative DNS server may need to be publicly reachable. An unintended open recursive resolver is dangerous because it can leak data and be abused for reflection or amplification attacks.
Why is port 53 open but DNS lookups still fail?
The network path may work while DNS policy or zone data is wrong. Check recursion settings, authoritative zone records, delegation, DNSSEC validation, TCP fallback, forwarders, and resolver logs.