I try opening my dns port by following rules:
iptables -A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
service iptables save
service iptables restart
But It not works, then I try Opening DNS from following:
system-config-firewall-tui
And it works.
What's the relation between iptables and firewall?
The
system-config-firewall
is just a mere frontend for iptables, which is the frontend for netfilter, the firewall in the linux kernel. Anyway your rule to open the DNS is wrong, it should be:You have to use the
-I
option, which means insert at the beginning of the chain. If your last rule prior the append says discard all traffic, then your new rule will never be invoked.You can check if the command you executed is effective by running the below query.