FTP Commands: PASV, PASV response, EPSV, PORT, PBSZ, REIN
PASV FTP command
This command tells the server to enter a passive FTP session rather than Active. This allows users behind routers/firewalls to connect over FTP when they might not be able to connect over an Active (PORT) FTP session. PASV mode has the server tell the client where to connect the data port on the server.
Common responses:
PASV response contains internal IP address
There are two ways to transfer data in FTP communications, active (PORT) and PASV. To learn more about the difference between these two modes of data transfer, see Active and Passive FTP Transfers defined.
Cause
The issue is caused when the FTP server is not correctly configured for PASV mode data transfers.
Resolution
For FTP Voyager 10.0.0.7 and later, substitute the known external IP address for an FTP server when it receives an internal IP address in the PASV command response from the server.
This is especially useful for secure/SSL connections where the server’s NAT router cannot translate the internal IP address into the proper external IP address since the communication is encrypted.
EPSV FTP command – Extended Passive Mode
The EPSV commands the server to enter a passive FTP session rather than Active which also requires IPv6. This allows users behind routers/firewalls to connect over FTP when they might not be able to connect over an Active (PORT/EPRT) FTP session. EPSV mode provides information where the client can connect for the data port on the server.
When using the EPSV command, the client includes information on the port that the server is used in order to connect back to the client. The structure of the EPSV command which is EPSV (|||Port|) is defined to allow servers to parse this information from the command. This does not include IP address information since it is assumed that the IP address of the data channel is the same as the address of the control channel.
PORT FTP command
The PORT command is issued by the client to initiate a data connection required to transfer data (such as directory listings or files) between the client and server. This command is used during “active” mode transfers.
When issuing the PORT command, the client will include information on the address and port that the server is to use in order to connect back to the client. Thus, the structure of this command is clearly defined to allow servers to parse this information from the command. The structure of the command is: PORT (h1,h2,h3,h4,p1,p2). The numbers used for the values of h1-h4 constitute the IP address the server should connect on. The numbers used for the values of p1-p2 are used to calculate the port number. In order to get the decimal value of the port, the following formula is used: (p1 * 256) + p2 = data port.
Common responses:
PBSZ FTP command
After completing the negotiation of a secure connection with the server, the client must issue the PBSZ command. This command sets the maximum size, in bytes, of the encoded data blocks to be sent or received during a file transfer. The provided parameter indicating the size requested by the client must be a 32-bit unsigned integer. If the server does not support the requested size and requires a smaller buffer, it must respond with an acceptable buffer size, which the client is required to use instead.
Common responses:
REIN FTP command
The REIN resets the FTP connection to the state it is in when the client first connects to the FTP server. Any file transfers in progress when the REIN command is sent are allowed to finish. The server should reset all parameters to their default states and flush all I/O and previous account information. The command connection remains open and a USER command may be expected to follow.
Common responses:
Serv-U Managed File Transfer Server
Let’s talk it over.
Contact our team. Anytime.