Search for:

Available article translations:

Rules disappear after restarting iptables

Article ID: 114881, created on Oct 3, 2012, last review on May 11, 2014

  • Plesk for Linux/Unix
  • Plesk Sitebuilder for Linux/Unix
  • Plesk Expand
  • Operations Automation
  • Business Automation
  • Odin Business Automation Standard
  • Virtuozzo containers for Linux
  • Virtuozzo hypervisor


I have stopped and started iptables with these commands:

# /etc/init.d/iptables stop
# /etc/init.d/iptables start

Now I see that some rules have disappeared. What could be the reason?


If rules were added using /sbin/iptables utility, they were added to a chain in the memory and were not committed to the hard disk. Upon restart, those rules were flushed from the memory and not restored.


In order to avoid losing rules during an iptables restart, you need to save them before the restart.

Method 1:
# iptables-save > iptables_save.txt

If using this method, you will need to restore the rules after the restart:
# iptables-restore <iptables_save.txt

Method 2:
# /etc/init.d/iptables save
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]

The above command saves the rules to the file system, and an iptables restart will not affect them.
This method is preferable if you want to leave the server intact.

56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 8760abb54be64bdc3c8805b6572624e8 d055be4fdc562a8ecb8e6d0bf419f946 fad6dc0c8e983c17ae70a51ac7952cd0 a26b38f94253cdfbf1028d72cf3a498b 2897d76d56d2010f4e3a28f864d69223 400e18f6ede9f8be5575a475d2d6b0a6 caea8340e2d186a540518d08602aa065 198398b282069eaf2d94a6af87dcb3ff 5356b422f65bdad1c3e9edca5d74a1ae e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 614fd0b754f34d5efe9627f2057b8642

Was this article helpful?
Tell us how we may improve it.
Yes No
Server Virtualization
- Odin Cloud Server
- Odin Containers for Windows 6.0
- Odin Virtuozzo Containers
- Odin Automation
- Odin Automation for Cloud Infrastructure
- Odin Business Automation Standard
- Odin Virtual Automation
- Odin Plesk Panel Suite
- Web Presence Builder
- Odin Plesk Automation
- Odin Small Business Panel
- Value-added Services for Hosters
- Odin Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification