Server rejects PORT or EPRT command with 504 replies

Data transfer command sequences that use the PORT or EPRT command fails when the server that receives the PORT or EPRT command is configured to reject all or certain PORT and EPRT commands. The reply code 504 indicates a problem of this nature.

For an ordinary transfer of data between client and server, the z/OS® FTP client sends the PORT command to server when:
  • The server does not support the EPSV command or the FTP session protocol is IPv4, and
  • The client is not configured to be firewall-friendly
You can correct this problem in one of the following ways:
  • Make the client firewall-friendly. Do this for the z/OS FTP client by coding FWFRIENDLY TRUE in the client FTP.DATA or by using a LOCSITE FWFRIENDLY subcommand before attempting the data transfer. The client sends EPSV or PASV to the server instead of PORT and the problem is avoided.
  • Log in to the server using the server IPv6 address. The client uses EPSV instead of PORT and the problem is avoided.
    Restriction: The server must have an IPv6 address.
  • Change the server configuration so that it does not reject PORT or EPRT commands.
  • Change the server so that it supports the EPSV command. The z/OS FTP server supports the EPSV command.

To change the client, see z/OS Communications Server: IP User's Guide and Commands for information about the FWFRIENDLY statement and the LOCSITE subcommand.

If you used the proxy subcommand to start the transfer, you are transferring data between two servers instead of between client and server. For a transfer of data between two servers, the client must send PORT or EPRT to one of the servers, and PASV or EPSV to the other server. If the server receiving the PORT or EPRT command is configured to reject the PORT or EPRT command, the proxy transfer fails with a 504 reply.

You can fix this problem in one of the following ways:
  • Reverse the order in which you open the server connections. That is, if you opened a connection to ServerA and proxy opened a connection to ServerB, open the connection to ServerB and proxy open the connection to ServerA. The client then sends PORT or EPRT to the other server during the proxy transfer. Provided the other server does not also reject PORT or EPRT, this avoids the problem.
    Restriction: If the file you are transferring is a load module, changing the order in which you open server connections does not always cause the client to send PORT or EPRT to the other server.
  • Transfer the file to a client, and then to the other server.
  • Change the server so that it does not reject PORT and EPRT commands.
The following are z/OS server FTP.DATA statements that can be coded to reject PORT and EPRT commands:
PORTCOMMAND
Reject all PORT and EPRT commands.
PORTCOMMANDPORT
Reject PORT and EPRT commands whose port number argument is a well-known port number.
PORTCOMMANDIPADDR
Reject PORT and EPRT commands whose argument is an IP address that is different from the client's IP address.

See z/OS Communications Server: IP Configuration Guide for more detail.