• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

ftp functions on server behind NAT won't do outbound transfers

SacAutos

Regular Pleskian
Plesk 10.2 on CentOS 5.6 . We've purchased a Virtual Machine with a local hosting company for hosting a web client. The provider's network assigns the VM a block of internal website addresses for use internally on their network and an external public IP address. NAT is used to do the translation from the public to private and vice versa. Overall it works well.

However, all FTP transfers in must use active mode. Though that was an unexpected adjustment inbound works fine this way. FTP out seems to be another matter. When I use the ftp command line utility from the VM, I can connect and transfer files to other servers with ease. But trying to use the ftp functions from within PHP isn't working. We have some regular cron jobs that are currently broken because they cannot transfer files outward. And this also effects the Plesk Backup processing: I wish to transfer files out regularly to a remote server for saving backup files.

To test and evaluate this problem I created this short FTP test program to see why it wasn't working (I have hidden the actual server and credentials for obvious reasons). I also created a brief text file called test.txt for the test:

--------- begin ---------
<?php

print ("\nConnecting\n");
$ftp_connection = ftp_connect ('myremoteserver.com');
print ("\nLogging in\n\n");
ftp_login ($ftp_connection,'username','password');
// print ("\nGoing active\n");
ftp_pasv ($ftp_connection,FALSE);
$filename = 'test.txt';
print ("\nWriting file\n\n");
ftp_put ($ftp_connection,$filename,$filename,FTP_ASCII);
print ("\nClosing\n");
ftp_close ($ftp_connection);
print ("\nDone!\n");

?>
--------- end ---------

When I ran the program interactively, here was the results:

--------- begin ---------
[root@cloud httpdocs]# php ftp2.php

Connecting

Logging in

Writing file

PHP Warning: ftp_put(): IP address does not match command connection address. in /var/www/vhosts/vmserver.com/httpdocs/ftp2.php on line 11

Closing

Done!

--------- end ---------

No file was transfered.

In looking at the FTP server log on the other end, the FTP server is attempting to connect to the internal IP address (10.16.25.80), which of course won't work. The external IP is the one needed, naturally. I have also tried running this test program with the passive command commented out. Same result.

I need to find a solution to this problem. Ideas??
 
Back
Top