The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

IPTables Rules not persisting

Discussion in 'Security' started by jameshaigh, Jan 4, 2011.

  1. jameshaigh

    jameshaigh Registered

    May 10, 2010
    Likes Received:
    Trophy Points:

    Please excuse if I've put this in the wrong section.

    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 remote mySQL access (a non-cPanel server), it reports that the connection is refused. Back on the cPanel server, all I need to do is service iptables restart and everything then works as normal.

    The cPanel server is a CentOS 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.
  2. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Feb 25, 2010
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    cPanel does not modify the iptables configuration.

    If you want iptables rules to take effect on boot, and you are not using a configuration script like CSF or APF, then the easiest thing to do is to place the rules in the file /etc/sysconfig/iptables. This file is read when the server boots. This is also where the default Red Hat/CentOS iptables rules are stored.

    The problem that you describe would not be caused by cPanel. cPanel does not change iptables rules and does not modify the /etc/sysconfig/iptables file.

Share This Page