Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

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
add comment

2 Answers

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
add comment

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

iptables -L

share|improve this answer
add comment

Your Answer

 
discard

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.