From: mouss <mouss@netoyen.net>
Cc: netfilter@vger.kernel.org
Subject: Re: simple netfilter machine redirection
Date: Sun, 16 Mar 2008 23:36:50 +0100 [thread overview]
Message-ID: <47DDA102.4060607@netoyen.net> (raw)
In-Reply-To: <alpine.DEB.1.00.0803161825030.19487@p34.internal.lan>
Justin Piszcz wrote:
>
>
> On Sun, 16 Mar 2008, Marty Leisner wrote:
>
>> I want to accomplish something simple with iptables..
>> (I've used IPtables successfully without really understanding how to do
>> something from scratch -- I just followed "recipes")
>>
>> I want machine A to redirect port 80 to machine B.
>>
>> What's a way to do it? (seems simple enough).
>>
>> I've tried a number of ways, and nothing seems to work...
>>
>> (the machine isn't a firewall)
>>
>> marty
>
> 152] How do I forward a port from the internet to the LAN? iptables -A
> PREROUTING -i eth0 -t nat -p tcp --dport 22 -j DNAT --to 192.168.0.5:22
>
> Forward port 22 -> internally to host 192.168.0.5:22 for instance.
>
> .. and yes I did test this just now, it still works :)
OP did not give enough details. The above works if the machine is a
"gateway" (if A is between the client and B).
if the client and B are on the same side of the gateway, B will respond
directly to the client. and since there is no TCP triplet, this won't
work (This is the "reflection" problem). If this is the case, OP must
also NAT the client (source) IP address to force responses to get back
via machine A.
next prev parent reply other threads:[~2008-03-16 22:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-16 23:23 simple netfilter machine redirection Marty Leisner
2008-03-16 22:28 ` Justin Piszcz
2008-03-16 22:36 ` mouss [this message]
2008-03-17 0:10 ` Marty Leisner
2008-03-16 23:11 ` Jan Engelhardt
2008-03-17 9:31 ` mouss
2008-03-17 10:29 ` Pascal Hambourg
2008-03-17 14:25 ` Grant Taylor
2008-03-16 22:45 ` bossk
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=47DDA102.4060607@netoyen.net \
--to=mouss@netoyen.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 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.