VMware Cloud Community
Feuervogel
Contributor
Contributor

Strange Perl NET::FTP Problems on ESX3 Server

Part of a perl script that I've written that is to be deployed on a bunch of esx 3 servers has a odd problem that is really stumping me. I'm posting here because I'm 99% sure that this doesn't have anything to do with my script and I have a nasty feeling that there is a chance the the hold up might be related to the ESX os and how it handles network interfaces.

Randomly, after successfully connecting to and authenticating to an ftp, the data connection fails while trying to transfer files. This failure can last for a few minutes to hours, and I see nothing that would suggest why or how long this would happen. This is the output I get from the script when I encounter this error.

Net::FTP=GLOB(0x8408ec8)<<< 220 Microsoft FTP Service

Net::FTP=GLOB(0x8408ec8)>>> user X

Net::FTP=GLOB(0x8408ec8)<<< 331 Password required for X.

Net::FTP=GLOB(0x8408ec8)>>> PASS ....

Net::FTP=GLOB(0x8408ec8)<<< 230 User X logged in.

Net::FTP=GLOB(0x8408ec8)>>> PASV

Net::FTP=GLOB(0x8408ec8)<<< 227 Entering Passive Mode (155,109,45,64,6,113).

Net::FTP=GLOB(0x8408ec8)>>> APPE file.csv

Net::FTP=GLOB(0x8408ec8)<<< 425 Can't open data connection.

This is the code I use for the ftp in the script. It usually works with no issues, but sometimes yeilds the above.

$ftp = Net::FTP->new("$ftpalias", Debug => 1)

or die "Cannot connect to $ftpalias: $@";

$ftp->login("X","X")

or die "Cannot login ", $ftp->message;

$ftp->append("$output", "$host.csv")

or die "Data Transfer Failed ", $ftp->message,

sleep (1800),

$ftp = Net::FTP->new("$ftpalias", Debug => 1),

$ftp->login("X","X"),

$ftp->append("$output", "$host.csv");

$ftp->quit;

Does anyone know what could be the issue, or runs a perl script that ftp's with no issues what so ever?

0 Kudos
3 Replies
Texiwill
Leadership
Leadership

Hello,

This is an issue with the ESX firewall. Try using a 'PASV' , Passive style connection. FTP requires ALOT of ports to be opened to receive the incoming data stream. I rather use SSH/SCP,SFTP over ftp. It does not require as many open ports.

You can get OpenSSH for your Microsoft host including SCP/SFTP server. Then use NET::SSH or NET::SSH::Perl.

Best regards,

Edward

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
Feuervogel
Contributor
Contributor

Net::FTP=GLOB(0x8408ec8)>>> PASV

Net::FTP=GLOB(0x8408ec8)<<< 227 Entering Passive Mode (155,109,45,64,6,113).

I do use passive mode, and you're right, I have to use passive or it won't work at all. You might be on to something with the scp/sftp server though. I'll try that.

0 Kudos
ealaqqad
Enthusiast
Enthusiast

Hi,

I was actually wondering if this problem was releated the login account used in the script to access the ftp. I had the same problem earlier with SFTP if I use the root account without enabling SSH Access for root, before trying to access SFTP with the root account. Although this is not recommended you might still want test it out with the SSH access enabled for root. A post on how ot enable ssh access for root can be found at:[ VMware VI3 Root Shell Access|http://www.virtualizationteam.com/virtualization-vmware/vmware-vi3-root-shell-access.html]

I hope this help some one, if it does please reward points.

Enjoy,

Eiad Al-Aqqad

System X & Storage Technical Specialist

Founder of http://www.VirtualizationTeam.com

Regards, Eiad Al-Aqqad Technology Consultant @ VMware b: http://www.VirtualizationTeam.com b: http://www.TSMGuru.com
0 Kudos