Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: POSTROUTING
Date: Wed, 18 Feb 2004 23:31:24 +0000	[thread overview]
Message-ID: <200402182331.24802.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <20040219004520.18352b71.arnt@c2i.net>

On Wednesday 18 February 2004 11:45 pm, Arnt Karlsen wrote:

> On Wed, 18 Feb 2004 18:25:34 +0000,
> Antony Stone <Antony@Soft-Solutions.co.uk> wrote in message
>
> <200402181825.35022.Antony@Soft-Solutions.co.uk>:
> > On Wednesday 18 February 2004 6:26 pm, capsx wrote:
> > >
> > > I want as source to specify a chain
> > > not -s 10.0.0.0/27 but something like -s LOCAL_NET_CHAIN
> >
> > You can't do that.   -s takes an address or network range.   -i takes
> > an interface name.   You cannot specify anything else as the 'source'
> > of a packet.
>
> ..I suspect he means he wants " -s $LOCAL_NET " or somesuch, such
> variables needs first be defined like ' LOCAL_NET="10.0.0.0/27" ',
> for larger sites, it's possible to script these definitions, check the
> http://tldp.org/LDP/abs/html/ over at http://tldp.org/guides.html for
> ideas.

I guess you might be right - he may have a sufficiently complex set of 
internal network ranges that he's matching them in a user-defined chain, and 
then wants to perform later rules depending on whether that chain matched or 
not.

If that's the case, then I suggest to "capsx":

match the addresses in your local network and jump to a user-defined chain 
when a match occurs, then do what you want for local packets in the 
user-defined chain.

For example:

# create a user-defined chain for local packets
iptables -N LOCAL_NET
# match the three segments of our local network
iptables -A FORWARD -s 192.168.1.0/24 -j LOCAL_NET
iptables -A FORWARD -s 192.168.10.0/24 -j LOCAL_NET
iptables -A FORWARD -s 192.168.100.0/24 -j LOCAL_NET
# now process the packets which came from the local network/s
iptables -A LOCAL_NET -j LOG --log-prefix="Local packet: "
# packets which didn't come from the local network/s will never see
# the user-defined chain

Hope this gets the idea across?

Antony.

-- 
Christmas was an opportunity to upgrade to kernel 2.6 while no-one was around 
to notice the downtime.

                                                     Please reply to the list;
                                                           please don't CC me.



      reply	other threads:[~2004-02-18 23:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-18 15:08 POSTROUTING capsx
2004-02-18 17:52 ` POSTROUTING Alexis
2004-02-18 18:07   ` POSTROUTING capsx
2004-02-18 18:14     ` R: POSTROUTING giovanni costagliola
2004-02-18 18:26       ` POSTROUTING capsx
2004-02-18 18:25         ` POSTROUTING Antony Stone
2004-02-18 23:45           ` POSTROUTING Arnt Karlsen
2004-02-18 23:31             ` Antony Stone [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=200402182331.24802.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --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