<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: How Do I Save Iptables Rules or Settings?</title> <atom:link href="http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Debianero</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-57048</link> <dc:creator>Debianero</dc:creator> <pubDate>Mon, 04 Apr 2011 00:49:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-57048</guid> <description>&lt;blockquote&gt;If you are using Debian Linux open /etc/network/interfaces...&lt;/blockquote&gt;
No! in Debian you must save your rules in
&lt;pre&gt;/etc/network/if-pre-up.d/iptables&lt;/pre&gt; this
&lt;pre&gt;#!/bin/bash
/sbin/iptables-restore &lt; /etc/iptables.up.rules&lt;/pre&gt;
That&#039;s, of course, if you&#039;re using bash and have save the rules in this way
&lt;pre&gt;iptables-save &gt; /etc/iptables.up.rules&lt;/pre&gt;</description> <content:encoded><![CDATA[<blockquote><p>If you are using Debian Linux open /etc/network/interfaces&#8230;</p></blockquote><p>No! in Debian you must save your rules in</p><pre>/etc/network/if-pre-up.d/iptables</pre><p> this</p><pre>#!/bin/bash
/sbin/iptables-restore &lt; /etc/iptables.up.rules</pre><p>That&#8217;s, of course, if you&#8217;re using bash and have save the rules in this way</p><pre>iptables-save &gt; /etc/iptables.up.rules</pre>]]></content:encoded> </item> <item><title>By: S. P.</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-48145</link> <dc:creator>S. P.</dc:creator> <pubDate>Wed, 30 Jun 2010 13:10:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-48145</guid> <description>Does not work on Ubuntu 8.04</description> <content:encoded><![CDATA[<p>Does not work on Ubuntu 8.04</p> ]]></content:encoded> </item> <item><title>By: Kirk Steuber</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-42243</link> <dc:creator>Kirk Steuber</dc:creator> <pubDate>Thu, 25 Jun 2009 17:52:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-42243</guid> <description>This solution works well assuming one of two things:
Either:
1) You are only using rules that are compatible with the GUI firewall editor (system-config-securitylevel)
or
2) You are not using system-config-securitylevel
system-config-securitylevel rewrites iptables without any lines it does not like (in my case, for example the rule &quot;-I &#039;RH-Firewall-1-INPUT&#039; 1 -s x.x.x.x -j ACCEPT&quot; where x.x.x.x is an ip address) - system-config-securitylevel does not support filtering by source or destination computer (for some reason)
The workaround I found for this is to:
1) create a file called /etc/sysconfig/iptables-custom
2) add the rule to the file. If you need a template for adding rules, look at your /etc/sysconfig/iptables file to see your existing rules
3) edit /etc/init.d/iptables
In the start() function there should be a line that says something like this:
&quot;$IPTABLES-restore $OPT $IPTABLES_DATA&quot;
This means to restore the rules from /etc/sysconfig/iptables
BELOW THIS RULE add a line that says
&quot;$IPTABLES-restore -n &lt; /etc/sysconfig/iptables-custom&quot;
The -n option is important. Without it, you would overwrite all other rules and ONLY have the rules in iptables-custom (meaning system-config-securitylevel wouldn&#039;t work any more as it would edit an unused file)
The one thing to keep in mind is that updating/reinstalling iptables will likely rewrite /etc/init.d/iptables, removing the line that adds iptables-custom</description> <content:encoded><![CDATA[<p>This solution works well assuming one of two things:<br
/> Either:<br
/> 1) You are only using rules that are compatible with the GUI firewall editor (system-config-securitylevel)<br
/> or<br
/> 2) You are not using system-config-securitylevel</p><p>system-config-securitylevel rewrites iptables without any lines it does not like (in my case, for example the rule &#8220;-I &#8216;RH-Firewall-1-INPUT&#8217; 1 -s x.x.x.x -j ACCEPT&#8221; where x.x.x.x is an ip address) &#8211; system-config-securitylevel does not support filtering by source or destination computer (for some reason)</p><p>The workaround I found for this is to:<br
/> 1) create a file called /etc/sysconfig/iptables-custom<br
/> 2) add the rule to the file. If you need a template for adding rules, look at your /etc/sysconfig/iptables file to see your existing rules<br
/> 3) edit /etc/init.d/iptables<br
/> In the start() function there should be a line that says something like this:<br
/> &#8220;$IPTABLES-restore $OPT $IPTABLES_DATA&#8221;<br
/> This means to restore the rules from /etc/sysconfig/iptables<br
/> BELOW THIS RULE add a line that says<br
/> &#8220;$IPTABLES-restore -n &lt; /etc/sysconfig/iptables-custom&quot;<br
/> The -n option is important. Without it, you would overwrite all other rules and ONLY have the rules in iptables-custom (meaning system-config-securitylevel wouldn&#039;t work any more as it would edit an unused file)</p><p>The one thing to keep in mind is that updating/reinstalling iptables will likely rewrite /etc/init.d/iptables, removing the line that adds iptables-custom</p> ]]></content:encoded> </item> <item><title>By: Hitesh</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-40863</link> <dc:creator>Hitesh</dc:creator> <pubDate>Mon, 23 Mar 2009 11:38:37 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-40863</guid> <description>Gr8 Man Thanks a lot.....</description> <content:encoded><![CDATA[<p>Gr8 Man Thanks a lot&#8230;..</p> ]]></content:encoded> </item> <item><title>By: Joe</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-39218</link> <dc:creator>Joe</dc:creator> <pubDate>Fri, 14 Nov 2008 00:47:58 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-39218</guid> <description>On Redhat/Fedora, you can do
service iptables save
And it will write a file in /etc/sysconfig that will be read on startup if the iptables service is enabled in the current runlevel.</description> <content:encoded><![CDATA[<p>On Redhat/Fedora, you can do</p><p>service iptables save</p><p>And it will write a file in /etc/sysconfig that will be read on startup if the iptables service is enabled in the current runlevel.</p> ]]></content:encoded> </item> <item><title>By: Simon Rostron</title><link>http://www.cyberciti.biz/faq/how-do-i-save-iptables-rules-or-settings/#comment-37577</link> <dc:creator>Simon Rostron</dc:creator> <pubDate>Thu, 06 Mar 2008 06:42:35 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/faq/how-do-i-save-iptables-rules-or-settings.php#comment-37577</guid> <description>Thank you!  This helped me out a lot.</description> <content:encoded><![CDATA[<p>Thank you!  This helped me out a lot.</p> ]]></content:encoded> </item> </channel> </rss>
