Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Rob Sterenborg <rob@sterenborg.info>
To: netfilter@lists.netfilter.org
Subject: Re: DROP before PREROUTING
Date: Wed, 03 May 2006 15:10:44 +0200	[thread overview]
Message-ID: <4458ABD4.80005@sterenborg.info> (raw)
In-Reply-To: <52837e3e0605030548v485078e0w7ae6bbb9492d674a@mail.gmail.com>

Bruno Nunes wrote:
> Hi folks,
>   i have this rule which forwards all incoming requests for ipA to a
> local machine as you can see.
>    iptables -t nat -A PREROUTING -d <ipA> -i eth0 -p tcp --dport 80
> -j DNAT --to 192.168.1.4
> 
>  is there any way to allow only a range of machines to use this
> specific rule (not interfering with the other rules)? dropping all
> requests that are not welcome.

By specifying the source IP('s).

iptables -t nat -A PREROUTING -s <src_ip[/mask]> -d <dst_ip> \
  -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.1.4

If you have the iprange match installed, you can also use that to match
a range instead of a subnet or host.
http://www.netfilter.org/projects/patch-o-matic/pom-base.html#pom-base-iprange


Gr,
Rob



      parent reply	other threads:[~2006-05-03 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03 12:48 DROP before PREROUTING Bruno Nunes
2006-05-03 13:07 ` Maximilian Wilhelm
2006-05-03 13:10 ` Rob Sterenborg [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=4458ABD4.80005@sterenborg.info \
    --to=rob@sterenborg.info \
    --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