Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mauricio Tavares <raubvogel@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter@vger.kernel.org
Subject: Re: newbie: forward rule to itself
Date: Wed, 27 Oct 2010 17:03:33 -0400	[thread overview]
Message-ID: <4CC893A5.1010808@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1010272157440.23548@obet.zrqbmnf.qr>

On 10/27/2010 04:00 PM, Jan Engelhardt wrote:
>
> On Wednesday 2010-10-27 21:47, Mauricio Tavares wrote:
>>>>
>>>> I have the following rules to forward port 6969 coming on eth0 on server1 to
>>>> port 6969 on server2's eth0:
>>>>
>>>> iptables -A PREROUTING -t nat -p tcp --dport 6969 -j DNAT --to
>>>> 192.168.1.server2:6969
>>>> iptables -A INPUT -d 192.168.4.server1 -p tcp -m tcp -m state --state NEW
>>>> --dport 6969 -j ACCEPT
>>>> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
>>>
>>> That prerouting only applies to packets coming from devices connected to
>>> the machine.
>>
>> 	How would the prerouting that applies to packets coming from the
>> machine itself look like?
>
> Mean to say it without "that". The entire PREROUTING chain won't be considered
> for nat.
> Usually, you just directly connect to the proper address preferably
> ith a DNS name if available. Alternate and rather redundant
> communication ways are rinetd.
>
	I am rather confused. Do you mean the prerouting chain is not 
considered for nat at all or just not for this specific case I had in mind?

Incidentally, I am not in love with those rules I created at all. All I 
want to do is to have any traffic to 192.168.4.server1:6969 will be sent 
to 192.168.1.server2:6969 no matter where it was originated from (be it 
somewhere in 192.168.1.0, 192.168.4.0, or even from withing server1). So 
far I cannot figure out a good way to accomplish that.

  reply	other threads:[~2010-10-27 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 19:02 newbie: forward rule to itself Mauricio Tavares
2010-10-27 19:17 ` Jan Engelhardt
2010-10-27 19:47   ` Mauricio Tavares
2010-10-27 20:00     ` Jan Engelhardt
2010-10-27 21:03       ` Mauricio Tavares [this message]
2010-10-28  8:01 ` Pascal Hambourg

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=4CC893A5.1010808@gmail.com \
    --to=raubvogel@gmail.com \
    --cc=jengelh@medozas.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