All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Newkirk <netfilter@newkirk.us>
To: Joe Yu <decade_joe@email.com>, netfilter@lists.netfilter.org
Subject: Re: How to set multi network ip forward ( prerouting )
Date: Sun, 24 Nov 2002 19:24:50 -0500	[thread overview]
Message-ID: <200211241924.50958.netfilter@newkirk.us> (raw)
In-Reply-To: <20021122074712.28320.qmail@email.com>

On Friday 22 November 2002 02:47 am, Joe Yu wrote:
> Sorry Sir,
>
> I have multi network
> Net A : 10.128.0.0/255.255.0.0
> Net B : 10.129.0.0/255.255.0.0
> Net C : 10.129.0.0/255.255.0.0
> Net D : 10.131.0.0/255.255.0.0
> Net E : 10.138.0.0/255.255.0.0
> Net F : 10.192.0.0/255.255.0.0
> Net G : 10.192.0.0/255.255.0.0
> Net H : 10.64.0.0/255.255.0.0
>
> I want to set "iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -s
> -d < Net A,B,C,D,E,F,G,H > -j REDIRECT 8080
>
> How to type multi network setting command

Either individual rules for each subnet, or (if acceptable) a single rule  
specifying 10.0.0.0/8, for instance, to catch ALL 10.x.x.x.  (this presumes 
that you want this redirect for ALL, or that you handle non-redirected 
subnets earlier in the chain than this)

If the catch-all isn't useful for you, then set up something like this:

iptables -n httpredirect
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j subnettest
iptables -A httpredirect -s 10.128.0.0/16 -j REDIRECT 8080
iptables -A httpredirect -s 10.129.0.0/16 -j REDIRECT 8080

This will group all the subnet tests together in a separate user-defined chain 
(named for it's function, for simplicity) for easier bookkeeping and access.  
Anything not explicitly covered in subnettest would then return to PREROUTING 
and continue through the main chain.  (unless you finish the subnettest chain 
with a DROP or ACCEPT or something to catch)

BTW, is it a typo, or are subnets B&C and subnets F&G really the same?

j



      reply	other threads:[~2002-11-25  0:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-22  7:47 How to set multi network ip forward ( prerouting ) Joe Yu
2002-11-25  0:24 ` Joel Newkirk [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=200211241924.50958.netfilter@newkirk.us \
    --to=netfilter@newkirk.us \
    --cc=decade_joe@email.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.