LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptables works fine but not after boot (https://www.linuxquestions.org/questions/linux-security-4/iptables-works-fine-but-not-after-boot-119423/)

wslogue 11-24-2003 06:46 AM

iptables works fine but not after boot
 
I've got iptables working absolutely fine on my machine (Redhat 8) but when I reboot my machine, all ports are closed. If I log in as root using the keyboard and just do service iptables restart, everything starts working again.

I'm wondering if anyone has experienced this. My network card is a bit non-standard and I needed to use a custom driver for it so, noticing that iptables was started up before the network card was, I renamed the S---- file in rc3.d so that it was numerically higher than the network. I actually renamed it S98iptables so it's one of the last things to get started. Still didn't work.

So then I edited /etc/rc.d/rc and, at the very end of the file, put service iptables restart. Still no luck.

When I examine boot.log, I can see that the iptables service is being started up at the very end and yet it still doesn't work. Only by logging in as root through the keyboard and restarting the service can I get it to work.

I'm not using DHCP and my machine has a static address on my local 192.168 subnet.

hazza 11-24-2003 08:04 AM

Looks like you may have a problem with the init scripts. Try using chkconfig to configure iptables to start in runlevels 2,3,4 and 5:

chkconfig iptables on

Then you might want to use rpm to verify the integrity of the iptables package files:

rpm -Vf iptables

You can verify the integrity of the the initscripts package files with:

rpm -Vf initscripts

If you notice that some of the /etc/rc.d/rc* scripts have been changed then you can grab a fresh copy from the rpm using mc (Midnight Commander - it can browse through rpms).

wslogue 11-24-2003 09:51 AM

Thanks Hazza,

in the end, the whole thing turned out to be something else completely.

My fstab file specified a samba share on another machine that was no longer present. Little did I realise it but as my machine was booting up, it was halting when fstab tried to mount this directory and wouldn't resume booting until a key had been pressed.

Rather than lug my 19" monitor over to the server, I was just plugging in a keyboard and typing blind to login and restart the iptables service. What was happening, though I couldn't see it, was that my keypresses for logging in caused the boot process to resume. The keypresses were buffered up so when the boot process finished, it then whizzed through the login. It wasn't the logging in and restarting iptables that was making it work, simply the fact that it had finished booting.

Anyway, all's well that ends well. A cautionary tale for anyone who doesn't have a monitor plugged into their server.


All times are GMT -5. The time now is 04:47 PM.