Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Vigneswaran R <vignesh@atc.tcs.com>
To: Manu <traqueur@club-internet.fr>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: PREROUTING to a non local subnet
Date: Tue, 17 Sep 2013 10:10:40 +0530	[thread overview]
Message-ID: <5237DD48.5020808@atc.tcs.com> (raw)
In-Reply-To: <5236FAB3.2000401@club-internet.fr>

[seems the mailing list IP is missed. adding it]

On 09/16/2013 06:03 PM, Manu wrote:
> For me the traffic is being dropped in the right place as when I do a 
> netstat on the 192.168.2.100 I see that there is an open connection 
> with 180.180.180.180 (<-- my server running iptable).
> But the IP of the computer i'm running my test from is 200.200.200.200
> There is the strange point as when I use the same rules for forwarding 
> a port to a computer on the same subnet than the server i see a 
> connection from 200.200.200.200 and not 180.180.180.180
> It seem that iptables rewrite the from ip adresse when it does port 
> forwarding to a computer which is not on the same subnet.

I think, some SNAT rule is doing that (may be as a side effect of your 
VPN configuration?).

> I hope 'im clear enough. Tell me if it is not the case.

Regards,
Vignesh

> Le 16/09/2013 11:23, Vigneswaran R a écrit :
>> On 09/09/2013 08:04 PM, Manu wrote:
>>> Hello
>>>
>>> I'm running iptable v1.4.7 on a linux with two NIC.
>>> One has adress 192.168.1.31 (the lan)
>>> The other has a public IP. Let's say 180.180.180.180
>>>
>>> On the lan, I have a VPN which join two network : 192.168.1.0 and 
>>> 192.168.2.0
>>>
>>> I'm trying to forward 5900 port (vnc) to a computer which is on the 
>>> second subnet with adress 192.168.2.100
>>> iptables -A PREROUTING -t nat -p tcp  -i eth1 --dport 5900 -j DNAT 
>>> --to-destination 192.168.2.100:5900
>>> iptables -A FORWARD -p tcp -d 192.168.2.100--dport 5900 -j ACCEPT
>>> and it doesn't work
>>
>> Does this machine have route to 192.168.2.0 network? Try to use 
>> tcpdump and see where the traffic is being dropped.
>>
>> Regards,
>> Vignesh
>>
>>>
>>> I've tried the same on the local network with adress 192.168.1.99
>>> iptables -A PREROUTING -t nat -p tcp  -i eth1 --dport 5900 -j DNAT 
>>> --to-destination 192.168.1.99:5900
>>> iptables -A FORWARD -p tcp -d 192.168.1.99--dport 5900 -j ACCEPT
>>> and it's working like a charm
>>>
>>> I've done my test with another computer with public adress 
>>> 200.200.200.200
>>>
>>> I've done a netstat one the two computers
>>> on 192.168.2.100 i've seen he's talking to 180.180.180.180 (<-- my 
>>> server running iptable)
>>> on 192.168.1.99 i've seen he's talking to 200.200.200.200 (<-- the 
>>> computer on internet which i'm running my test from)
>>>
>>> thanks for your attention
>>> -- 
>>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>


      parent reply	other threads:[~2013-09-17  4:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 14:34 PREROUTING to a non local subnet Manu
2013-09-16  7:26 ` Manu
2013-09-16 21:08   ` Humberto Jucá
2013-09-16  9:23 ` Vigneswaran R
     [not found]   ` <5236FAB3.2000401@club-internet.fr>
2013-09-17  4:40     ` Vigneswaran R [this message]

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=5237DD48.5020808@atc.tcs.com \
    --to=vignesh@atc.tcs.com \
    --cc=netfilter@vger.kernel.org \
    --cc=traqueur@club-internet.fr \
    /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