Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Everytime my server reboots it seems I have to reset my iptables to default, I used to use firestarter but removed it a while ago. Is there any settings that are making iptables change when the server reboots?

share|improve this question
up vote 9 down vote accepted

This is the default behavior.

You may want to take a look at the package iptables-persistent to automatically set iptables rules at startup from a configuration file.

share|improve this answer
Thanks this was driving me crazy resetting the tables every time we had to reboot the server – Anagio Dec 3 '11 at 9:39

iptables-persistent by default does NOT automatically save the system's iptables when rebooting.

However, I modified the source code of the package in Ubuntu 14.04 to automatically save the rules on reboot, shutdown (halt), or runlevel 1. When the system boots to runlevels 2-5, the rules are restored. This way, saving and loading the rules happens automatically without user intervention.

To use this version, please use the following commands:

sudo apt-get remove iptables-persistent
sudo dpkg -r iptables-persistent
sudo dpkg --install iptables-persistent_0.5.8_all.deb

See my full blog post here:

Use at your own risk. All that was modified is the init script stop function calls the save rules function so that when the system is shutdown, rebooted, or in level1, the rules are automatically saved.

I've tested this updated deb package on Ubuntu 12.04, Ubuntu 14.04, and Ubuntu 15.04. It should work on any version of debian as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.