All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: Is ip_conntrack_ftp needed for 1:1 nat?
Date: Wed, 07 Jun 2006 14:56:31 +0200	[thread overview]
Message-ID: <4486CCFF.2070903@plouf.fr.eu.org> (raw)
In-Reply-To: <A78C6C481BFAE949BC5990E1EEB2FE1257BF@q.LeBlancNet.us>

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.



  parent reply	other threads:[~2006-06-07 12:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=4486CCFF.2070903@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --cc=netfilter@lists.netfilter.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.