Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Simion Onea <simionea@gmail.com>
To: Thomas Jacob <jacob@internet24.de>
Cc: netfilter@vger.kernel.org
Subject: Re: Forwarding packets over the same LAN
Date: Tue, 14 Jul 2009 10:58:06 +0300	[thread overview]
Message-ID: <1247558286.7214.16.camel@TestField.intranet.bem.md> (raw)
In-Reply-To: <1247494451.25529.52.camel@enterprise.ims-firmen.de>

On Mon, 2009-07-13 at 16:14 +0200, Thomas Jacob wrote:
> You need DNAT+SNAT for this:
> 
> # Redirect to IP:Port
> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10025 \
> 	 -j DNAT --to-destination 172.20.1.254:25
> 
> # Ensure that the replies come back to us
> iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 25 \
>          -d 172.20.1.254  -j SNAT --to-source 172.20.1.245

Hi Thomas!

I tried these rules but it seems that packets to not pass the first
rule. To test this I put two LOG targets before and after the PREROUTING
rule like this:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10025 -j LOG
--log-tcp-options --log-prefix PREROUTING_before:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10025 -j DNAT
--to-destination 172.20.1.254:25
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25 -j LOG
--log-tcp-options --log-prefix PREROUTING_after:
iptables -t nat -A POSTROUTING -o eth0 -p tcp -d 172.20.1.254 --dport 25
-j SNAT --to-source 172.20.1.245

As a result I received in the log three messages with
"PREROUTING_before" -- these were SYN packets. And no message with
"PREROUTING_after" :-(

What could be wrong ?

Regards,
Simion.



  reply	other threads:[~2009-07-14  7:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 14:00 Forwarding packets over the same LAN Simion Onea
2009-07-13 14:14 ` Thomas Jacob
2009-07-14  7:58   ` Simion Onea [this message]
2009-07-14  9:25     ` Mart Frauenlob
2009-07-14 12:20       ` Simion Onea
2009-07-14 12:40         ` Mart Frauenlob
2009-07-14 12:30       ` Thomas Jacob
2009-07-14 12:27     ` Thomas Jacob
2009-07-14 13:06       ` Simion Onea
2009-07-15  7:38       ` Simion Onea
2009-07-14 15:33     ` Pascal Hambourg
2009-07-14 18:50       ` Simion Onea
2009-07-14 15:34     ` Thomas Jacob
2009-07-14 19:01       ` Simion Onea
2009-07-14 20:36         ` Vincent Bernat
2009-07-15  7:32         ` Pascal Hambourg
2009-07-15  7:40           ` Simion Onea
2009-07-15 20:12             ` Mike Williams
2009-07-16  5:59               ` Simion Onea

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=1247558286.7214.16.camel@TestField.intranet.bem.md \
    --to=simionea@gmail.com \
    --cc=jacob@internet24.de \
    --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