I'm trying to allow a host access to port 3306 by IP. I've added the rule and ran an iptables-save and also service iptables save. These commands show as "OK" with no reported errors. And this works absolutely fine.

Now, the server hasn't been restarted at all since I've been having this problem, but every day when I start developing on the server that needs mySQL access, it reports that the connection is refused. Back on the mySQL server, all I need to do is service iptables restart and everything then works as normal.

The mySQL server is a CentOS cPanel VPS running on OpenVZ.

Anyone know how I can make these rules persist? Is it something cPanel is doing overnight that is messing with my config? Thanks.

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

James, Make sure that your /etc/sysconfig/iptables file contains the rules you have configured; if they're not in there then you should add them, and this should resolve the issue.

Eric

link|improve this answer
feedback

Try add the following line to /etc/sysconfig/iptables file and restart the iptables.

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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