iptables changes don't survive reboot - CentOS

Discussion in 'Installation/Configuration' started by frontier, Sep 5, 2011.

  1. frontier

    frontier New Member

    Hi guys,

    By default Centos 5.6 seems to be blocking incoming HTTP traffic through the firewall.

    I can fix the issue with this:

    iptables -I RH-Firewall-1-INPUT -p tcp --dport 80 -j ACCEPT
    And Apache will work until I restart the server, when my changes vanish.

    What's the most appropriate method to commit these changes so they can survive a restart? I'm extremely new to Linux (setting up a cloud server via Putty - literally have an hour's experience with the platform). Updating / installing Apache / configuring vhosts was a breeze but this has me stumped!

    Appreciate any tips :) I guess it could be done with an auto-executing batch to run that command every reboot but that seems very inelegant.

  2. Mark_NL

    Mark_NL Member

    There are multiple ways to do this kind of stuff.

    When i know it's just 1-5 rules i put them all in /etc/rc.local
    more rules and i make a /etc/init.d/script and add it to the rc's
  3. TiTex

    TiTex Member

    /etc/init.d/iptables save
    to save your rules, or just do what Mark suggested

Share This Page