Port reference › Network infrastructure
Port 53 · DNS
Domain name lookups
TCP/UDP Network infrastructure Exposure risk: Medium
What is port 53 used for?
DNS. Normal queries use UDP; large responses and zone transfers (AXFR) use TCP. Blocking TCP 53 breaks some lookups.
Well-known port (0-1023): opening it on Linux needs root (or CAP_NET_BIND_SERVICE).
Security notes
An open resolver gets abused for DNS amplification. Allow recursion only for internal networks and zone transfers only for secondaries.
Allow port 53 through the firewall
This port is risky to expose, so the commands below allow only the IPs you specify.
# Replace 203.0.113.10/32 with the IP or network you want to allow
sudo ufw allow from 203.0.113.10/32 to any port 53 proto tcp
sudo ufw allow from 203.0.113.10/32 to any port 53 proto udp
sudo ufw status # Replace 203.0.113.10/32 with the IP or network you want to allow
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10/32" port port="53" protocol="tcp" accept'
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10/32" port port="53" protocol="udp" accept'
sudo firewall-cmd --reload # Replace 203.0.113.10/32 with the IP or network you want to allow
sudo iptables -A INPUT -p tcp -s 203.0.113.10/32 --dport 53 -j ACCEPT
sudo iptables -A INPUT -p udp -s 203.0.113.10/32 --dport 53 -j ACCEPT # Replace 203.0.113.10/32 with the IP or network you want to allow
New-NetFirewallRule -DisplayName "Allow TCP 53" -Direction Inbound -Protocol TCP -LocalPort 53 -RemoteAddress 203.0.113.10/32 -Action Allow
New-NetFirewallRule -DisplayName "Allow UDP 53" -Direction Inbound -Protocol UDP -LocalPort 53 -RemoteAddress 203.0.113.10/32 -Action Allow # Replace sg-0123456789abcdef0 with your security group ID
aws ec2 authorize-security-group-ingress --group-id sg-0123456789abcdef0 --protocol tcp --port 53 --cidr 203.0.113.10/32
aws ec2 authorize-security-group-ingress --group-id sg-0123456789abcdef0 --protocol udp --port 53 --cidr 203.0.113.10/32 Check whether port 53 is open
sudo ss -tulpn | grep ':53 ' netstat -ano | findstr :53 nc -zv SERVER 53
# Windows
Test-NetConnection SERVER -Port 53 sudo lsof -i :53 Ports used together
- 853 DNS over TLS · Encrypted DNS (DoT)