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 am trying to add the following line in the /etc/sysconfig/iptables in CentOS so I will be allowed to access mysql.

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

I already did # service iptables restart and that doesn't resolve this. I have already done this a couple of times for other ports and a simple service restart does not help. Is there a way to go around this without rebooting the server?

share|improve this question

migrated from stackoverflow.com May 11 '12 at 11:03

This question came from our site for professional and enthusiast programmers.

    
Off-topic for SO; belongs on Server Fault or Unix & Linux –  Ex Umbris May 11 '12 at 5:21

2 Answers 2

Agreed that topic should be migrated.

However, one thing to verify is that your ACCEPT rules come before your REJECT rule(s).

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
share|improve this answer

first and foremost, it's not a good practice to edit the /etc/sysconfig/iptables file. To add rules on your iptables, do something like this:

/sbin/iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT
/sbin/service iptables save
/sbin/service iptables restart

well, anyway..with regards to your question, if you still don't have some important rules on your iptables, try to flush/remove all rules

/sbin/iptables -F

then, add your desired rules. don't forget to add the basic rules like to accept ports 80 (http), 22 (ssh), 21 (ftp), 443 (https), etc.

but if you already have some configured rules, just remove your manual input rule and add/insert it the right way.

share|improve this answer

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.