# [SOLVED] iptables Won't Start Automatically

## archrax

Hello everyone,

I wrote a script to setup my iptables. At the end, as per the wiki, I have;

```

/etc/init.d/iptables save

rc-update add iptables boot

```

When I run the script, all the rules therein load as expected. I can start and stop iptables no problem and it works as expected.

However, whenever I reboot and run

```

/sbin/iptables -L -v

```

all I get is the default policy set i.e. all 3 main chains have been set to ACCEPT. All my rules seem to have disappeared.

Any ideas what I'm doing wrong? I'm sure it must be something simple - but clearly too simple for me to figure out!

thanksLast edited by archrax on Tue Dec 27, 2011 2:29 pm; edited 1 time in total

----------

## Hu

Does the initscript print any error messages when it runs during boot?

----------

## archrax

 *Quote:*   

> Does the initscript print any error messages when it runs during boot?

 

No. In fact, I get the following message;

```

Loading iptables state and starting firewall...              [ok]

```

Clearly then, it's a question of the rules not being saved for some reason. Everything else is working fine.

----------

## archrax

It's working now.

All I did was log in as root, run my script and reboot. Strange. Didn't seem happy to save under sudo.

Thanks for input anyway Hu.

----------

