– Problem With Iptables

Home » CentOS » – Problem With Iptables
CentOS 8 Comments

hi all,

I have a problem with iptables on CentOS 6.2. I configured:

chkconfig iptables on and the file /etc/sysconfig/iptables

if you reboot the machine configurations are not loaded. iptables-L gives me the default configurations (not assigned)
if I (a machine booted): service iptables start then then it works.

how can I fix?
thanks in advance

8 thoughts on - – Problem With Iptables

  • After service iptables start do:

    service iptables save

    This saves your configuration for the next restart / reboot


  • ChriG, thank you for your help I solved the problem but until now it had never happened with the VPS. iptables first started out and then edit the file /etc/sysconfig/iptables and chkconfig iptables on

    good to know many thanks

    2013/10/10 Chris Geldenhuis

  • ‘service iptables save’ tells iptables to take what’s running in iptables RIGHT NOW and save it to that file. so your added lines got overwritten. so what previous replies have been expecting you to do is boot up login as root start doing your commands e.g. iptables -I INPUT -s -I eth0
    -j DROP
    get all the iptables command entries set to how you want them, check with iptables -L
    then run ‘service iptabels save’
    and reboot just to be sure all your rules got saved and are restored after a boot. (although it shouldn’t technically be required)

  • When you do
    # service iptables save it over-writes /etc/sysconfig/iptables with the active set of iptables, so your changes are lost. One way to do what you want is to modify /etc/sysconfig/iptables, then do
    # service iptables restart This will reload the iptables from /etc/sysconfig/iptables