Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Покотиленко Костик" <casper@meteor.dp.ua>
To: "TinyApps.Org" <miles@tinyapps.org>
Cc: netfilter@lists.netfilter.org
Subject: Re: Question about /etc/iptables.down.rules
Date: Mon, 27 Aug 2007 11:42:30 +0300	[thread overview]
Message-ID: <1188204150.13621.19.camel@localhost.localdomain> (raw)
In-Reply-To: <F4B37970-02BE-4A40-B9E3-1BE5B7D5AAEF@tinyapps.org>

В Вск, 26/08/2007 в 22:01 -1000, TinyApps.Org пишет:
> Thanks for your reply, Покотиленко! (I hope that is the correct name  
> to use.)
> My reply is at the bottom of this message:
> 
> >> I understand that it is best to setup a set of rules to be applied
> >> when the network interface is down, saving it to:
> >>
> >>   /etc/iptables.down.rules
> >>
> >> and applying in /etc/network/interfaces via:
> >>
> >> post-down iptables-restore < /etc/iptables.down.rules
> >>
> >> What should this set of rules look like? The exact opposite
> >> of /etc/iptables.up.rules ? Or just a simple flush command?
> >> Or something else altogether?
> >
> > You can do a simple flush, but this is not required, since all rules
> > will be overwritten by iptables-restore when you bring network  
> > interface
> > up next time.
> 
> I had stumbled across the following comment:
> 
> "But to do this really clean, we need to have a script that removes  
> the rules as well for when the interface goes down. Just to make sure  
> the rules are never added twice."
> 
> on this site:
> http://my.opera.com/Jada0007/blog/show.dml/1213354
> 
> and therefore wondered if there were ever a case in which
> the rules could be applied twice... by creating a /etc/ 
> iptables.down.rules
> file, I hoped to avoid such a possibility.

man iptables-restore states:
...
       -n, --noflush

       don't flush the previous contents of the table. If not specified,
              iptables-restore flushes (deletes) all previous contents
of  the
              respective IP Table.
...

So, make sure you won't use "-n" option when calling iptables-restore.

-- 
Покотиленко Костик <casper@meteor.dp.ua>



      reply	other threads:[~2007-08-27  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-27  1:51 Question about /etc/iptables.down.rules TinyApps.Org
2007-08-27  7:52 ` Покотиленко Костик
2007-08-27  8:01   ` TinyApps.Org
2007-08-27  8:42     ` Покотиленко Костик [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1188204150.13621.19.camel@localhost.localdomain \
    --to=casper@meteor.dp.ua \
    --cc=miles@tinyapps.org \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox