Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Anders Fugmann <afu@fugmann.dhs.org>
To: Scott Ainslie <scott_ainslie@hotmail.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: PREROUTING exclude
Date: Thu, 05 Sep 2002 15:09:06 +0200	[thread overview]
Message-ID: <3D775772.60604@fugmann.dhs.org> (raw)
In-Reply-To: F16XvpFVjCRGryWtIIZ000009c9@hotmail.com

Scott Ainslie wrote:
> I want the following rule to work for all machines on my subnet except 
> for 192.168.0.4. How do I exclude this single machine from this rule?
> 
> /sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp \
> -s 192.168.0.0/24 \
> -d 0/0 --dport 80 \
> -j DNAT --to 192.168.0.4:3128
> 

The general "all but some" case, can be done by making a new chain, and 
implement fall-through in this chain.

Given the above example you could do:

iptables -t nat -N DNAT_INT
iptables -t nat -A DNAT_INT -s 192.168.0.4 -j RETURN
iptables -t nat -A DNAT_INT -j DNAT --to 192.168.0.4:3128
iptables -t nat -A PREROUTING -s 192.168.0.0/24 --dport 80 -J DNAT_INT

Or somthing in the likes of that. (I removed the -d 0/0, since its 
redundant = default, and I would also suggest adding and interface 
constraint, just to be sure).

Regards
Anders Fugmann

--
Author of FIAIF
FIAIF Is An Intelligent Firewall
http://fiaif.fugmann.dhs.org




      parent reply	other threads:[~2002-09-05 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-05 12:50 PREROUTING exclude Scott Ainslie
2002-09-05 13:01 ` Antony Stone
2002-09-05 13:09 ` Anders Fugmann [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=3D775772.60604@fugmann.dhs.org \
    --to=afu@fugmann.dhs.org \
    --cc=netfilter@lists.netfilter.org \
    --cc=scott_ainslie@hotmail.com \
    /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