All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: "DNAT" w/o changing source address?
Date: Thu, 04 Oct 2007 16:17:25 +0200	[thread overview]
Message-ID: <4704F5F5.7010601@plouf.fr.eu.org> (raw)
In-Reply-To: <1191503642.13379.12.camel@localhost.localdomain>

John Madden a écrit :
> 
> Hmm, well here are the rules I'm running.  The port forward:
> 
> echo "1" > /proc/sys/net/ipv4/ip_forward
> iptables -t nat -A PREROUTING -d $EXTIP -p tcp --dport 25 -j DNAT --to
> $MAILSERVER:25
> 
> And the SNAT for return traffic:
> 
> iptables -t nat -A POSTROUTING -d $MAILSERVER -j SNAT --to $EXTIP

Ok, this is the rule that changes the source address. The DNAT rule in 
the PREROUTING chain could not do it, even with a kernel 2.6.9.

> ...At least, I found that traffic wouldn't flow without this additional
> rule.  Have I gotten something else fundamentally wrong here?

The above SNAT rule itself is not for return traffic. First, it matches 
packets destined to the mail server, i.e. original traffic. Second, 
return traffic skips the nat table chains.

If traffic does not flow without it, it could mean that the mail server 
does not send the reply traffic back to the NAT box. This is a routing 
problem. Does the mail server use the NAT box as its default gateway ?

  parent reply	other threads:[~2007-10-04 14:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03 15:21 "DNAT" w/o changing source address? John Madden
2007-10-03 23:35 ` Grant Taylor
2007-10-03 23:50   ` Pascal Hambourg
2007-10-04  1:17     ` Grant Taylor
2007-10-04 13:14     ` John Madden
2007-10-04 13:14   ` John Madden
2007-10-04 14:09     ` Grant Taylor
2007-10-04 14:19       ` John Madden
2007-10-04 15:13         ` Grant Taylor
2007-10-04 14:17     ` Pascal Hambourg [this message]
2007-10-04 14:22       ` John Madden
2007-10-04 14:59         ` Pascal Hambourg
2007-10-04 15:13           ` John Madden
2007-10-04 15:29             ` Grant Taylor
2007-10-04 19:33               ` Grant Taylor
2007-10-04 16:01             ` Pascal Hambourg
2007-10-04 15:23           ` Grant Taylor
2007-10-04 15:52             ` Pascal Hambourg
2007-10-04 19:12               ` Grant Taylor
2007-10-04 19:25                 ` John Madden

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=4704F5F5.7010601@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --cc=netfilter@vger.kernel.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.