Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


And it works.

What's the relation between iptables and firewall?

share|improve this question
You probably didn't insert your rules with the right ordering with respect to the existing iptables rules. Have a look at iptables -nvL to see how the rules are setup. – mgorven Feb 6 '13 at 18:17
Open /etc/sysconfig/iptables , the file to which system-config-firewall-tui writes, and compare the it your commands. – Daniel t. Feb 6 '13 at 18:24
up vote 6 down vote accepted

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:

iptables -I INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT

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.

share|improve this answer

You can check if the command you executed is effective by running the below query.

iptables -L

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.