Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 12-06-2006, 10:51 PM   #1
Registered: Feb 2006
Distribution: RHCL 5
Posts: 233

Rep: Reputation: 30
Unhappy how to save iptables firewall rules permanently

Hi all,

I created sm firewall rules using iptables but they gets flushed out as i reboot the system. is thr any way these entries remain rermanent in the system. i tries iptables save command but nothing happened.
what to do ?
Old 12-07-2006, 01:45 AM   #2
Simon Bridge
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
write the iptables rules to a script. Add the script to a bootscript. If you tell us which distro you are using, we may be able to tell you a distro-specific way to do this.

iptables-save only dumps the current rules to std-out.
you can pipe the rules into a text file with iptables-save > firewall

some distros have an iptables script in /etc/sysconfig/iptables, so you save your settings with: iptables-save > /etc/sysconfig/iptables

Last edited by Simon Bridge; 12-07-2006 at 01:54 AM.
Old 12-07-2006, 03:09 AM   #3
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Save iptables rule in some file for ex and then chmod 755
then run as root


copy firewal inside /etc/init.d ... and make it run during boot process

Old 12-07-2006, 11:53 AM   #4
Registered: Mar 2004
Posts: 36

Rep: Reputation: 15
If you are running a RedHat based distro (such as RedHat, RHEL, Fedora or CentOS) you can just use the INIT script to save the rules.

/etc/init.d/iptables save

If I remember right, it also works on Gentoo.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables-save, but rules don't load on boot-up kpachopoulos Debian 2 11-18-2006 10:36 PM
Iptables rules for basic firewall winxandlinx Linux - Security 7 10-27-2006 07:12 AM
Problem Iptables, Firewall rules. Can anybody help ? ZliTroX Linux - Networking 9 09-06-2004 04:48 PM
iptables save rules Osten Debian 1 02-10-2004 04:53 PM
Firewall Rules Problem with Iptables JereBear Linux - Networking 1 06-16-2002 04:28 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration