All of lore.kernel.org
 help / color / mirror / Atom feed
* Problem with SNAT
@ 2004-09-02 18:57 Bgs
  2004-09-02 20:17 ` Jason Opperisano
  0 siblings, 1 reply; 8+ messages in thread
From: Bgs @ 2004-09-02 18:57 UTC (permalink / raw)
  To: Netfilter


  Greetings,

I have problems with the following setup:

A linux with two NICs. One with IP of 10.0.2.2 and one with 10.0.3.57.
I have DNAT-ed traffic coming in on the 10.0.2.2 that was originally 
sent to 10.0.2.1. (Another node doing the DNAT). I have problems on the 
route back so I decided to SNAT the backward udp traffic to  soource 
10.0.2.1 and send the SNATed packets back on another route.

I added the line to nat postrouting (-d target_net -s 10.0.2.2 -p udp -j 
SNAT --to-source 10.0.2.1) but the packages don't even seem to hit the 
nat postrouting chain. Let alone my SNAT rule.

Any ideas what could be wrong ?

Thanks
Bgs




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with SNAT
  2004-09-02 18:57 Problem with SNAT Bgs
@ 2004-09-02 20:17 ` Jason Opperisano
  2004-09-03 11:06   ` Alistair Tonner
  2004-09-03 17:00   ` Bgs
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Opperisano @ 2004-09-02 20:17 UTC (permalink / raw)
  To: netfilter

On Thu, 2004-09-02 at 14:57, Bgs wrote:
>   Greetings,
> 
> I have problems with the following setup:
> 
> A linux with two NICs. One with IP of 10.0.2.2 and one with 10.0.3.57.
> I have DNAT-ed traffic coming in on the 10.0.2.2 that was originally 
> sent to 10.0.2.1. (Another node doing the DNAT). I have problems on the 
> route back so I decided to SNAT the backward udp traffic to  soource 
> 10.0.2.1 and send the SNATed packets back on another route.
> 
> I added the line to nat postrouting (-d target_net -s 10.0.2.2 -p udp -j 
> SNAT --to-source 10.0.2.1) but the packages don't even seem to hit the 
> nat postrouting chain. Let alone my SNAT rule.
> 
> Any ideas what could be wrong ?
> 
> Thanks
> Bgs

since i have to guess (hint:  post your rules [1] if you want us to find
the problem for you)...

i would say that your filter rules drop the packet before they ever get
to the POSTROUTING chain of the nat table.

-j

[1] - iptables -vnL && iptables -t nat -vnL && iptables -t mangle -vnL

-- 
Jason Opperisano <opie@817west.com>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with SNAT
  2004-09-02 20:17 ` Jason Opperisano
@ 2004-09-03 11:06   ` Alistair Tonner
  2004-09-03 17:00   ` Bgs
  1 sibling, 0 replies; 8+ messages in thread
From: Alistair Tonner @ 2004-09-03 11:06 UTC (permalink / raw)
  To: netfilter

On September 2, 2004 04:17 pm, Jason Opperisano wrote:
> On Thu, 2004-09-02 at 14:57, Bgs wrote:
> >   Greetings,
> >
> > I have problems with the following setup:
> >
> > A linux with two NICs. One with IP of 10.0.2.2 and one with 10.0.3.57.
> > I have DNAT-ed traffic coming in on the 10.0.2.2 that was originally
> > sent to 10.0.2.1. (Another node doing the DNAT). I have problems on the
> > route back so I decided to SNAT the backward udp traffic to  soource
> > 10.0.2.1 and send the SNATed packets back on another route.
> >
> > I added the line to nat postrouting (-d target_net -s 10.0.2.2 -p udp -j
> > SNAT --to-source 10.0.2.1) but the packages don't even seem to hit the
> > nat postrouting chain. Let alone my SNAT rule.
> >
> > Any ideas what could be wrong ?
> >
> > Thanks
> > Bgs
>
> since i have to guess (hint:  post your rules [1] if you want us to find
> the problem for you)...
>
> i would say that your filter rules drop the packet before they ever get
> to the POSTROUTING chain of the nat table.
>
> -j
>
> [1] - iptables -vnL && iptables -t nat -vnL && iptables -t mangle -vnL

	Furthermore we could use with the routing table on the box as well .

	classically 10.x.x.x addressed networks have a mask of 255.0.0.0
	which might not result in good routes.

	Alistair.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with SNAT
  2004-09-02 20:17 ` Jason Opperisano
  2004-09-03 11:06   ` Alistair Tonner
@ 2004-09-03 17:00   ` Bgs
  1 sibling, 0 replies; 8+ messages in thread
From: Bgs @ 2004-09-03 17:00 UTC (permalink / raw)
  To: netfilter



>>A linux with two NICs. One with IP of 10.0.2.2 and one with 10.0.3.57.
>>I have DNAT-ed traffic coming in on the 10.0.2.2 that was originally 
>>sent to 10.0.2.1. (Another node doing the DNAT). I have problems on the 
>>route back so I decided to SNAT the backward udp traffic to  soource 
>>10.0.2.1 and send the SNATed packets back on another route.
>>
>>I added the line to nat postrouting (-d target_net -s 10.0.2.2 -p udp -j 
>>SNAT --to-source 10.0.2.1) but the packages don't even seem to hit the 
>>nat postrouting chain. Let alone my SNAT rule.
 >
> since i have to guess (hint:  post your rules [1] if you want us to find
> the problem for you)...
> 
> i would say that your filter rules drop the packet before they ever get
> to the POSTROUTING chain of the nat table.
> 
> -j
> 
> [1] - iptables -vnL && iptables -t nat -vnL && iptables -t mangle -vnL
> 

  Greetings,

I don't have access right no to the box, but I dumped the traffic and 
the packets go out unSNATed :)
The boxes ruleset is completely empty, it has only this one rule...
Netmasks are 24bits.

Incoming packet to 10.0.2.2 (originally sent to 10.0.2.1). Outbound udp 
traffic from 10.0.2.2 should be SNATed back to 10.0.2.1.

Bye
Bgs




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Problem with SNAT
@ 2006-05-24 19:59 Ian Batterbee
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Batterbee @ 2006-05-24 19:59 UTC (permalink / raw)
  To: netfilter

For those of you who remember my problem from a week or so ago, this is 
a continuation of the same thing.

I've now changed from using MASQ to using SNAT in order to work around 
the problem where MASQ and policy routing don't work together, however 
I've run into a new problem.

My linux box has 3 interfaces -
eth0 - 192.168.0.1/24 (outside - goes to an adsl modem
eth1 - x.x.252.33/29   (inside)
ppp0 - z.z.2.204/32 (ssh tunnel to work)

In order to source nat anything I route down the tunnel onto the 
tunnel's IP address,I have the following SNAT command active:

iptables -t nat -I POSTROUTING -o ppp0 -j SNAT --to-source z.z.2.204

The problem is that the -o ppp0 bit seems to be being ignored. If I ssh 
from my windows machine (x.x.252.36) to x.x.252.33,  my address gets 
translated to z.z.2.204, even though it the address I connect to is on 
the same subnet. I.e., it shouldn't have gone anywhere near the ppp0 
interface.

A tcpdump -n shows that the SYN comes from the correct address of 
x.x.252.36, and the reply is sent there, but unless I add ALL:z.z.2.204 
into /etc/hosts, sshd resets the tcp connection, strongly suggesting 
that the SNAT has occured by the time the sshd process sees the packet.

Is this expected behaviour ?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Problem with snat.
@ 2017-07-16 22:07 sorcus
  2017-07-17  6:22 ` Arturo Borrero Gonzalez
  0 siblings, 1 reply; 8+ messages in thread
From: sorcus @ 2017-07-16 22:07 UTC (permalink / raw)
  To: netfilter-devel

Can you confirm that a bug or not?

https://serverfault.com/questions/861375/what-wrong-with-snat-in-nftables
http://marc.info/?t=149969788400002&r=1&w=2
https://github.com/NixOS/nixpkgs/issues/27093

No one can help me. And i don't know what i need doing now.
Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with snat.
  2017-07-16 22:07 Problem with snat sorcus
@ 2017-07-17  6:22 ` Arturo Borrero Gonzalez
  2017-07-17 12:50   ` sorcus
  0 siblings, 1 reply; 8+ messages in thread
From: Arturo Borrero Gonzalez @ 2017-07-17  6:22 UTC (permalink / raw)
  To: sorcus; +Cc: Netfilter Development Mailing list

On 17 July 2017 at 00:07,  <sorcus@inwebse.com> wrote:
> Can you confirm that a bug or not?
>
> https://serverfault.com/questions/861375/what-wrong-with-snat-in-nftables
> http://marc.info/?t=149969788400002&r=1&w=2
> https://github.com/NixOS/nixpkgs/issues/27093
>
> No one can help me. And i don't know what i need doing now.

You are probably lacking the reply NAT chain, which needs to be registered.

https://wiki.nftables.org/wiki-nftables/index.php/Performing_Network_Address_Translation_(NAT)

I'm updating right now the wiki to put this in bold.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Problem with snat.
  2017-07-17  6:22 ` Arturo Borrero Gonzalez
@ 2017-07-17 12:50   ` sorcus
  0 siblings, 0 replies; 8+ messages in thread
From: sorcus @ 2017-07-17 12:50 UTC (permalink / raw)
  To: Arturo Borrero Gonzalez; +Cc: Netfilter Development Mailing list

Thank you so much. Now it's working.

On 2017-07-17 06:22, Arturo Borrero Gonzalez wrote:
> You are probably lacking the reply NAT chain, which needs to be 
> registered.
> 
> https://wiki.nftables.org/wiki-nftables/index.php/Performing_Network_Address_Translation_(NAT)
> 
> I'm updating right now the wiki to put this in bold.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-17 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02 18:57 Problem with SNAT Bgs
2004-09-02 20:17 ` Jason Opperisano
2004-09-03 11:06   ` Alistair Tonner
2004-09-03 17:00   ` Bgs
  -- strict thread matches above, loose matches on Subject: below --
2006-05-24 19:59 Ian Batterbee
2017-07-16 22:07 Problem with snat sorcus
2017-07-17  6:22 ` Arturo Borrero Gonzalez
2017-07-17 12:50   ` sorcus

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.