From: "Stephen J. McCracken" <sjmccracky@myrealbox.com>
To: Andrew Kraslavsky <andykras@hotmail.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: Rule "labels"?
Date: Thu, 14 Apr 2005 16:32:47 -0500 [thread overview]
Message-ID: <425EE17F.9010705@myrealbox.com> (raw)
In-Reply-To: <BAY106-F357CEE5BD3D8B2616C1AD6D6350@phx.gbl>
Andrew Kraslavsky wrote:
[snip]
> This equates to the following 2 rules, one in the 'nat' table and the
> other in the 'filter' table:
>
> iptables -t nat -A PREROUTING -i $PUBLIC_IF -p tcp --dport 80 -j DNAT
> --to 192.168.168.23
>
> iptables -t filter -A FORWARD -i $PUBLIC_IF -d 192.168.168.23 -p tcp
> --dport 80 -j ACCEPT
>
> Later, the user decides to disable the policy which means deleting both
> of the rules above. Since I cannot rely on knowing the indices of each
[snip]
>
> Ideally, the delete command would remove all rules in the specified
> chain with the specified label, or all rules within the specified table,
> or even across all chains in all tables, but I'm not that greedy...
>
> Suggestions?
It might not be as elegant as you are looking for, but I do something
similar with adding/deleting rules when VPNs come up/go down. I have
been simply generating rules in a file and sourcing that file in the
VPN_up script. I then have that file saved for the case when the VPN
goes down and just do a simple sed script to change all adds to deletes
and source that file in the VPN_down script. You don't have the problem
of finding rules dynamically as you have the file that generated the
rules hanging around and can easily reverse the process changing "-A" to
"-D".
Like I said, maybe not elegant, but it works.
sjm
next prev parent reply other threads:[~2005-04-14 21:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-14 20:48 Rule "labels"? Andrew Kraslavsky
2005-04-14 21:02 ` Taylor, Grant
2005-04-14 21:32 ` Stephen J. McCracken [this message]
2005-04-14 23:08 ` Andrew Kraslavsky
-- strict thread matches above, loose matches on Subject: below --
2005-04-14 23:03 Andrew Kraslavsky
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=425EE17F.9010705@myrealbox.com \
--to=sjmccracky@myrealbox.com \
--cc=andykras@hotmail.com \
--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