Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: DNAT with orignal source address
Date: Thu, 03 Aug 2006 01:37:19 +0200	[thread overview]
Message-ID: <44D1372F.7020003@plouf.fr.eu.org> (raw)
In-Reply-To: <A78C6C481BFAE949BC5990E1EEB2FE125824@q.LeBlancNet.us>

Hello,

Robert LeBlanc a écrit :
> I'm having problems with my e-mail server saying that every connection
> originates from the NAT box. I checked it on my other linux server and
> sure enough even though I have 1:1 DNAT and a reverse SNAT configured,
> packets destined for my server show the NAT box as the source. How do
> you configure DNAT so that it keeps the original Internet address and
> does not mangle it, only the destination address to my server on a
> private subnet?

DNAT never mangles the source address in the PREROUTING chain. DNAT can 
mangle the source address only in the OUTPUT chain to match the new 
output interface.

> iptables -t nat -A PREROUTING -d 1.1.1.4 -j DNAT --to-destination
> 192.168.2.10
> iptables -t nat -A POSTROUTING -s 192.168.2.10 -j SNAT --to-source
> 1.1.1.4
> 
> So the gateway's public address is 1.1.1.1 and the e-mail server is
> 1.1.1.4. The e-mail logs and ssh logins all show that every connection
> is made from 1.1.1.1 even though the connections are made from the
> Internet.

I bet that is the result of another SNAT rule, maybe the one used to 
masquerade the private subnet on internet which matches more than it 
should. For instance you have :

iptables -t nat -A POSTROUTING -j SNAT --to 1.1.1.1

when you need :

iptables -t nat -A POSTROUTING -o <public_interface> -s 192.168.2.0/24 \
   -j SNAT --to 1.1.1.1


  reply	other threads:[~2006-08-02 23:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 22:34 DNAT with orignal source address Robert LeBlanc
2006-08-02 23:37 ` Pascal Hambourg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-08-03 14:34 Robert LeBlanc
2006-08-03 15:14 ` Pascal Hambourg
2006-08-03 14:52 Robert LeBlanc
2006-08-03 15:50 Robert LeBlanc

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=44D1372F.7020003@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --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