Linux IPTables blocking DNS and open port 53
Scenario / Question:
IPTables is blocking DNS and I can not get DNS from Internet.
Solution / Answer:
IPTables needs to be configured to allow INPUT of port 53 and the OUTPUT of port 53. DNS uses both tcp and udp protocols on port 53 for communicating. UDP is used for queries transferring less than 512 bytes of data and TCP is used for transferring larger queries.
Accept or Allow outgoing DNS requests:
In order to accept or allow outgoing DNS requests from a client system using iptables you can add the following iptable rules. These rules must be added above any deny all rules that may exist in your INPUT or OUTPUT iptable chains.
iptables -A INPUT -p tcp -m tcp --sport 53 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT iptables -A INPUT -p udp -m udp --sport 53 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT iptables -A OUTPUT -p tcp -m tcp --sport 1024:65535 --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -p udp -m udp --sport 1024:65535 --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT



[...] The rest is here: Linux IPTables blocking DNS and open port 53 [...]