LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   iptables doesn't start on boot up (https://www.linuxquestions.org/questions/linux-server-73/iptables-doesnt-start-on-boot-up-744603/)

Lee_Ball 08-02-2009 04:30 PM

iptables doesn't start on boot up
 
OK, I'm stumped on this one, can't seem to see the problem.

Running CentOS 5.3 and its upto date as of 10 minutes ago.

If I reboot it, everything comes back up but if I run iptables -L it shows me a blank tables list:

Code:

Chain INPUT (policy ACCEPT)
target    prot opt source              destination       

Chain FORWARD (policy ACCEPT)
target    prot opt source              destination       

Chain OUTPUT (policy ACCEPT)
target    prot opt source              destination

If I start the iptables service and run the same command my tables are back. I've checked ntsysv and ensured that iptables is ticked there, I've also done chkconfig and turned it on, my chkconfig output for iptables is:

Code:

iptables              0:off        1:off        2:on        3:on        4:on        5:on        6:off
Couldn't find anything in /var/log/message either.

Any ideas?

Berhanie 08-02-2009 08:34 PM

After you load your rules, you need to save them using service iptables save as mentioned here. After that, it'll do what you are expecting.

robertjinx 08-03-2009 01:39 AM

Just setup the firewall, then save the setup:

/etc/init.d/iptable save and then set it to start at boot:

chkconfig iptables on.

This should do the job.

Lee_Ball 08-03-2009 04:43 AM

You two were quite correct. Forgot you had to do that, I'd been putting it into /etc/sysconfig/iptables setting the service up and just expecting it to load.

Odd how you have to save them first, it does however remove my comments from the iptables script. Is this why it was broken?

sleddog 08-03-2009 04:50 AM

Quote:

Originally Posted by Lee_Ball (Post 3629333)
You two were quite correct. Forgot you had to do that, I'd been putting it into /etc/sysconfig/iptables setting the service up and just expecting it to load.

Odd how you have to save them first, it does however remove my comments from the iptables script. Is this why it was broken?

No. It wasn't starting on boot as you hadn't marked it as a service to be run at boot with "chkconfig iptables on"

Use "chkconfig --list | grep 3:on" to see which services will start at boot (runlevel 3).

Manage the list with "chkconfig serviceName on" or chkconfig serviceName off".

Lee_Ball 08-03-2009 08:07 AM

All I did was the /etc/init.d/iptables save I didn't do any of the other chkconfig items as already listed above, its already set to on.

Code:

iptables              0:off        1:off        2:on        3:on        4:on        5:on        6:off


All times are GMT -5. The time now is 06:46 AM.