Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Alistair Tonner <Alistair@alistairt.ath.cx>
To: Antony Stone <Antony@Soft-Solutions.co.uk>
Cc: netfilter@lists.netfilter.org
Subject: Re: doing prerouting/postrouting/output logfile problems
Date: Mon, 21 Oct 2002 15:02:23 -0400	[thread overview]
Message-ID: <20021021190223.GA754@Ajftl1.ajfthome.on.ca> (raw)
In-Reply-To: <200210211509.g9LF9lL32079@vulcan.rissington.net>; from Antony@Soft-Solutions.co.uk on Mon, Oct 21, 2002 at 11:09:41 -0400

> > firewall
> > eth0 = x.x.x.x (public ip)
> > eth1 = 192.168.2.1 (internal ip)
> >
> > webserver
> >
> > eth0 = 192.168.2.2
> >
> >  ${IPTABLES} -t nat -A PREROUTING -p tcp -d x.x.x.x --dport 80 -j
> DNAT
> > --to-destination 192.168.2.2
> 
> 
> >  ${IPTABLES} -t nat -A POSTROUTING -p tcp -d 192.168.2.2 --dport 80
> -j
> > SNAT --to-source 192.168.2.1
> 
> >  ${IPTABLES} -t nat -A OUTPUT -p tcp -d x.x.x.x --dport 80 -j DNAT
> > --to-destination 192.168.2.2
> 
> If you remove the SNAT rule from the POSTROUTING chain you will get
> correct
> entries in your webserver logfile.   However this will then break your
> 
> internal clients being able to access the public IP of the webserver
> (because
> the reply will come back from the private IP and the client will not
> be
> happy).
> 
> I suggest you modify the SNAT rule so that it only applies to packets
> from
> your local network:
> 
> ${IPTABLES} -t nat -A POSTROUTING -p tcp -s 192.168.2.0/24 -d
> 192.168.2.2
> --dport 80 -j SNAT --to-source 192.168.2.1
> 
> The you will see correct public IPs in your webserver logifle for
> extenal
> visitors, and 192.168.2.1 for all internal accesses - presumably you'd
> be
> happy with this ?
> 
> > I also use these lines for do mail traffic and I had some problems
> with
> > open Relaying.
> 
> Open Relaying is (a) a very bad thing to do, (b) nothing to do with
> netfilter
> rules, and (c) quite likely to get your mail server blocked by various
> 
> anti-spam databases.   I suggest you correct your mail server
> configuration
> file so that it is not an open relay.
> 
> > Also because 192.168.2.1 was allowed to mail.

	Presumably he was SNATting all packets originally... if he 
happened to be
	SNATting stuff through port25, the mailserver wouldn't know to 
block mail
	from outside.... since ... everything looked like it was inside 
... or at least
	the firewall...
	 
	Alistair


      parent reply	other threads:[~2002-10-21 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-21 13:57 doing prerouting/postrouting/output logfile problems Sander Sneekes
2002-10-21 15:09 ` Antony Stone
2002-10-21 17:25   ` Sander Sneekes
2002-10-21 19:02   ` Alistair Tonner [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=20021021190223.GA754@Ajftl1.ajfthome.on.ca \
    --to=alistair@alistairt.ath.cx \
    --cc=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