Page 1 of 1

500 Illegal PORT command

Posted: 3. Dec 2009, 17:42
by jstn
When I connect to my guest's FTP service I am able to authenticate; however, when I try to get a directory listing I get the "500 Illegal PORT command" error. A Google search showed a few bugs logged for this issue, unfortunately I was unable to find a resolve. Here is my current setup:

Host: Windows 7
Guest: Ubuntu 9.10 Server Edition
Guest FTP Service: vsftpd
VirtualBox version: 3.0.12 r54655

Here is an example of the connection:
C:\Users\USERNAME>ftp localhost
Connected to COMPUTERNAME.
220 (vsFTPd 2.2.0)
User (COMPUTERNAME:(none)): USERNAME
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
500 Illegal PORT command.
425 Use PORT or PASV first.
ftp>
Any help would be appreciated.

Re: 500 Illegal PORT command

Posted: 4. Dec 2009, 01:48
by MarkCranness
People haven't had much luck getting FTP servers to work inside VirtualBox NAT networking.
Either:

Set the VM to use Bridged networking (the VM will get an IP on your local lan in the normal way: DHCP from your lan router or set static).

OR, try and bypass the NAT caused problems, which might include:
  • Don't ftp connect to localhost, instead connect to the LAN IP of your host (yes, this may make a difference!)
  • Have the client use server passive mode (ftp.exe cannot, IE can) and set the vsftpd NAT helper parameters:
    Configure the vsftpd pasv_enable, pasv_min_port and pasv_max_port settings to a range of ports, and then VirtualBox port forward those ports.
    You will also need to set the vsftpd pasv_address setting (set it to the VM's 'external' IP address - which is the host's IP address).
    There is a problem here if you want to access the VM's ftp from outside your lan: the VM's external IP address inside your lan (when using VirtualBox NAT networking) is the same as your host's IP, but the VM's external address outside your lan (assuming you port forward your router to the VM) will be an actual external IP address.
  • AFAIK VirtualBox NAT networking does not provide an ALG for ftp, which may be required (or not).
  • Make sure you have VirtualBox NAT port forwarded the correct/enough ports.
  • Make sure the host's IP address does not match the subnet used by VirtualBox's NAT (10.0.2.x/24 by default).

Re: 500 Illegal PORT command

Posted: 8. Dec 2009, 15:58
by jstn
MarkCranness wrote:People haven't had much luck getting FTP servers to work inside VirtualBox NAT networking.
Either:

Set the VM to use Bridged networking (the VM will get an IP on your local lan in the normal way: DHCP from your lan router or set static).

OR, try and bypass the NAT caused problems, which might include:
  • Don't ftp connect to localhost, instead connect to the LAN IP of your host (yes, this may make a difference!)
  • Have the client use server passive mode (ftp.exe cannot, IE can) and set the vsftpd NAT helper parameters:
    Configure the vsftpd pasv_enable, pasv_min_port and pasv_max_port settings to a range of ports, and then VirtualBox port forward those ports.
    You will also need to set the vsftpd pasv_address setting (set it to the VM's 'external' IP address - which is the host's IP address).
    There is a problem here if you want to access the VM's ftp from outside your lan: the VM's external IP address inside your lan (when using VirtualBox NAT networking) is the same as your host's IP, but the VM's external address outside your lan (assuming you port forward your router to the VM) will be an actual external IP address.
  • AFAIK VirtualBox NAT networking does not provide an ALG for ftp, which may be required (or not).
  • Make sure you have VirtualBox NAT port forwarded the correct/enough ports.
  • Make sure the host's IP address does not match the subnet used by VirtualBox's NAT (10.0.2.x/24 by default).
I apologise for taking several days to respond as I can see you've taken time to give these suggestions; so thank you very much. The first thing I tried which you suggested worked which was connecting to the Guest VM via my LAN IP rather than using localhost. So, thanks again for the fix.

Re: 500 Illegal PORT command

Posted: 8. Dec 2009, 22:49
by MarkCranness
I'm glad to know it worked out, and I was curious to know if my LAN IP suggestion would work, so thanks for following up.

Re: 500 Illegal PORT command

Posted: 10. Dec 2009, 02:14
by nnigam
Changing from NAT to Bridged worked very well for me too. Thanks for the tip. However, it was working in bridged mode with my orignal version, about 2-3 versions back.

Thanks
Neeraj Nigam