All of lore.kernel.org
 help / color / mirror / Atom feed
* Is ip_conntrack_ftp needed for 1:1 nat?
@ 2006-06-06 15:52 Robert LeBlanc
  2006-06-06 16:16 ` Alexandru Dragoi
  2006-06-07 12:56 ` Pascal Hambourg
  0 siblings, 2 replies; 9+ messages in thread
From: Robert LeBlanc @ 2006-06-06 15:52 UTC (permalink / raw)
  To: netfilter

I have a gateway that is using iptables and I have several 1:1 NATs
configured. I am having trouble establishing an ftp session to my remote
server. The gateway has a virtual adapter with the public IP address and
I have SNAT and DNAT configured to forward all ports to the host. What
do I need to get this working? I keep getting refused ports errors.

Thanks,
Robert LeBlanc


^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Is ip_conntrack_ftp needed for 1:1 nat?
@ 2006-06-06 16:37 Robert LeBlanc
  0 siblings, 0 replies; 9+ messages in thread
From: Robert LeBlanc @ 2006-06-06 16:37 UTC (permalink / raw)
  To: Alexandru Dragoi; +Cc: netfilter



> -----Original Message-----
> From: Alexandru Dragoi [mailto:alex@zoomnet.ro]
> Sent: Tuesday, June 06, 2006 10:16 AM
> To: Robert LeBlanc
> Cc: netfilter@lists.netfilter.org
> Subject: Re: Is ip_conntrack_ftp needed for 1:1 nat?
> 
> Robert LeBlanc wrote:
> 
> >I have a gateway that is using iptables and I have several 1:1 NATs
> >configured. I am having trouble establishing an ftp session to my
remote
> >server. The gateway has a virtual adapter with the public IP address
and
> >I have SNAT and DNAT configured to forward all ports to the host.
What
> >do I need to get this working? I keep getting refused ports errors.
> >
> >Thanks,
> >Robert LeBlanc
> >
> >
> >
> # modprobe ip_nat_ftp
> 
> You may also use iproute2 for nat, but it may not work.

Thanks Alexandru, works like a charm now. I just loaded the ip_nat_ftp
module and it works great. I didn't even have to mess with iproute2.

Robert LeBlanc


^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Is ip_conntrack_ftp needed for 1:1 nat?
@ 2006-06-07 14:57 Robert LeBlanc
  2006-06-07 15:01 ` Sietse van Zanen
  2006-06-07 19:10 ` Pascal Hambourg
  0 siblings, 2 replies; 9+ messages in thread
From: Robert LeBlanc @ 2006-06-07 14:57 UTC (permalink / raw)
  To: netfilter

Hmmm, this has turned out to be an interesting discussion. I was under
the impression of what Sietse was saying would work, but it didn't. Only
after I had loaded the ip_conntrack_ftp module did my ftp connections
work. I would think that outside_ip:outside_port would directly
translate to inside_ip:outside_port. Since it is 1:1, there is no need
to mangle the ports, right? But, what Pascal is saying also makes sense
in that the FTP protocol contains the source IP and port, which wouldn't
make sense since it is a private address. At least that is what I
understand of the FTP protocol.

Are there any other protocols that have issues like this that I'm not
aware of?

Thank you,
Robert LeBlanc

> -----Original Message-----
> From: netfilter-bounces@lists.netfilter.org [mailto:netfilter-
> bounces@lists.netfilter.org] On Behalf Of Sietse van Zanen
> Sent: Wednesday, June 07, 2006 8:33 AM
> To: netfilter@lists.netfilter.org
> Subject: RE: Is ip_conntrack_ftp needed for 1:1 nat?
> 
> BZZZZZZZZT
> 
> You have just missed the 1.000.000 dollar question. The short answer
is
> indeed: NO.
> 
> When you do pure 1:1 NAT and don't filter any traffic, you do not need
to
> track connections, as any packet will just get NATted between the two
> addresses.
> 
> Whether this is a good setup, or a good idea, I don't think so. You
would
> probably need to do other things on your firewall then just 1:1 NAT
> between address(ranges).
> 
> -Sietse
> 
> ________________________________
> 
> From: netfilter-bounces@lists.netfilter.org on behalf of Pascal
Hambourg
> Sent: Wed 07-Jun-06 14:56
> To: netfilter@lists.netfilter.org
> Subject: Re: Is ip_conntrack_ftp needed for 1:1 nat?
> 
> 
> 
> Hello,
> 
> Robert LeBlanc wrote :
> > Is ip_conntrack_ftp needed for 1:1 nat?
> 
> The short answer is : yes, and ip_nat_ftp (which needs
ip_conntrack_ftp)
> is needed too to handle properly any NAT situation.
> 
> The longer answer is : the FTP conntrack and NAT helper modules are
not
> absolutely necessary in all NAT situations. But even in the case when
> they are not absolutely necessary, they can make the NAT and filtering
> setup much simpler.
> 
> To summarize, what do these modules do ?
> 
> In both active and passive modes, ip_conntrack_ftp expects and marks
as
> RELATED the first packet of an FTP data connection related to an
> established control FTP connection.
> 
> In passive mode, ip_nat_ftp modifies if necessary (i.e. when the
client
> address is masqueraded) the address and port numbers in the PORT
> commands sent by the client to the server over the control connection
> which tell the server which address and port to connect to to
establish
> the data connection. In passive mode, it modifies if necessary (i.e.
> when the server address is masqueraded) the address and port numbers
in
> the reply to the PASV command sent by the server to the client over
the
> control connection to tell the client which address and port to
connect
> to to establish the data connection.
> 
>   Note that both modules must be given in the 'ports' parameter the
list
> of destination ports that may be used for FTP control connection
> whenever there are  non standard ones (other than 21). This implies
that
> you must explicitly load ip_conntrack_ftp before ip_nat_ftp, else
> ip_nat_ftp will automatically load ip_conntrack_ftp but without
telling
> it which ports to monitor !
> 
> So, when are the FTP helper modules not necessary ?
> 
> - In passive mode when the server address is not masqueraded. If the
> client is masqueraded, the NAT device must masquerade and accept any
> connection from the client.
> 
> - In active mode when the client address is not masqueraded. If the
> server is masqueraded, the NAT device must masquerade and accept any
> connection from the server with uses the ftp-data source port (20/TCP
by
> default).
> 
> - In passive mode when the server is masqueraded but is able to send
its
> apparent address in the PASV reply and to use a restricted range of
> local ports for data connections. The NAT device must redirect (DNAT)
> and accept NEW connections on this port range to the server private
> address.
> 
> - In active mode when the client is masqueraded but is able to send
its
> apparent address in the PORT command and to use a restricted range of
> local ports for data connections. The NAT device must redirect (DNAT)
> and accept NEW connections on this port range to the client private
> address.
> 
> 
> 
> 



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

end of thread, other threads:[~2006-06-07 19:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-06 15:52 Is ip_conntrack_ftp needed for 1:1 nat? Robert LeBlanc
2006-06-06 16:16 ` Alexandru Dragoi
2006-06-07 12:56 ` Pascal Hambourg
2006-06-07 14:32   ` Sietse van Zanen
2006-06-07 15:16     ` Pascal Hambourg
  -- strict thread matches above, loose matches on Subject: below --
2006-06-06 16:37 Robert LeBlanc
2006-06-07 14:57 Robert LeBlanc
2006-06-07 15:01 ` Sietse van Zanen
2006-06-07 19:10 ` Pascal Hambourg

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.