Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mike Wright <mike.wright@mailinator.com>
To: Guido Trentalancia <guido@trentalancia.com>
Cc: Patrick McHardy <kaber@trash.net>, netfilter@vger.kernel.org
Subject: Re: Port forwarding with iptables on tunnel interface
Date: Fri, 12 Feb 2010 11:01:57 -0800	[thread overview]
Message-ID: <4B75A5A5.1000402@mailinator.com> (raw)
In-Reply-To: <1265995841.2980.125.camel@tesla.lan>

Guido Trentalancia wrote:
> Hello again !
> 
> There are two things that look odd to me:
> 
> 1) packets on port 25 are correctly forwarded (after decapsulation) to
> the redirected host on the 192.168.3.0 network *but* nothing goes back
> on the same network on port 25 (i.e. from interface eth0 to tunl0);
> 2) there is a very strange and very long MAC entry in the PREROUTING log
> for IN=tunl0.
> 
> I have tried using the target TRACE, but it doesn't help much. I've got
> plenty of LOG targets disseminated everywhere that TRACE doesn't add
> anything. But again, I can't see POSTROUTING from the host where packets
> are being forwarded and I can't see replies going back on eth0 from that
> same machine (the sendmail machine) to the iptables machine.
> 
> I also forgot to attach the iptables rules in my previous message, but
> here you go:
> 
> *raw
> :PREROUTING ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> -A PREROUTING -p tcp --dport 25 -j TRACE
> -A PREROUTING -p tcp --dport 25 -j TRACE
> COMMIT
> *nat
> :PREROUTING ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> :POSTROUTING ACCEPT [0:0]
> -A PREROUTING -p tcp --dport 25 -j LOG --log-prefix "PREROUTING: "
> -A PREROUTING -p tcp --dport 25 -j DNAT --to-destination 192.168.3.69
> -A PREROUTING -p tcp --dport 587 -j DNAT --to-destination 192.168.3.69
> -A OUTPUT -p tcp --dport 25 -j LOG --log-prefix "OUTPUT: "
> -A OUTPUT -p tcp --dport 25 -j DNAT --to-destination 192.168.3.69
> # The following rule is not related, it's masquerading for another
> network...
> -A POSTROUTING -o eth0 -s 192.168.4.0/24 -j MASQUERADE
> -A POSTROUTING -p tcp --dport 25 -j LOG --log-prefix "POSTROUTING: "
> -A POSTROUTING -o eth0 -p tcp --dport 25 -j MASQUERADE
> -A POSTROUTING -o eth0 -p tcp --dport 587 -j MASQUERADE
> #-A POSTROUTING -o eth0 -p tcp --dport 25 -j SNAT --to-source
> 192.168.3.64
> #-A POSTROUTING -o eth0 -p tcp --dport 587 -j SNAT --to-source
> 192.168.3.64
> COMMIT

<snip />

Salve, Guido.  I gave this a verrrry quick glance and off the top of my 
head I think something looks fishy in the POSTROUTING rules.

In the PREROUTING you are selecting based on the *destination* port.  On 
the return trip shouldn't POSTROUTING use *source* port?

Hope that helps,
Mike Wright

  reply	other threads:[~2010-02-12 19:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 18:14 Port forwarding with iptables on tunnel interface Guido Trentalancia
2010-02-11 18:57 ` Patrick McHardy
2010-02-11 19:20   ` Guido Trentalancia
2010-02-12  5:29     ` Patrick McHardy
2010-02-12 13:28       ` Guido Trentalancia
2010-02-12 14:41         ` Patrick McHardy
2010-02-12 15:21           ` Guido Trentalancia
2010-02-12 17:30           ` Guido Trentalancia
2010-02-12 19:01             ` Mike Wright [this message]
2010-02-12 19:23               ` Guido Trentalancia
2010-02-12 19:56                 ` Mike Wright
2010-02-12 22:27                   ` Guido Trentalancia
2010-02-11 20:05   ` Guido Trentalancia

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=4B75A5A5.1000402@mailinator.com \
    --to=mike.wright@mailinator.com \
    --cc=guido@trentalancia.com \
    --cc=kaber@trash.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox