What port does DNS use?
DNS uses port 53 over TCP/UDP.
| Port | Protocol | Name | What it is for |
|---|---|---|---|
| 53 | TCP/UDP | DNS | Domain name resolution. UDP for normal queries, TCP for responses over 512 bytes and for zone transfers. |
What catches people out
An open recursive resolver will be abused for DNS amplification attacks. Restrict recursion to your own networks.
Checking it is listening
sudo lsof -i :53 # macOS, Linux
netstat -ano | findstr :53 # Windows
nc -zv host 53 # from elsewhere
An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.
Frequently asked questions
What port does DNS use?
DNS uses port 53 over TCP/UDP. Domain name resolution. UDP for normal queries, TCP for responses over 512 bytes and for zone transfers.
What should I watch out for with port 53?
An open recursive resolver will be abused for DNS amplification attacks. Restrict recursion to your own networks.
How do I check whether DNS is listening?
sudo lsof -i :53 on macOS or Linux, netstat -ano | findstr :53 on Windows. From another machine, nc -zv host 53 says whether anything answers.