425 error opening data socket

This is a How-to guide on how to set up your router with FileZilla Server (FZS) in order to fix the error code 425. There is a Wiki on Network Configuration that covers this information, however, it is written in such a way that the “layman” may have difficulty understanding what’s going on—and it doesn’t show exactly how to fix the 425 error code—so this Wiki will give instructions on how to set up your specific router.

Introduction[edit]

This is a How-to guide on how to set up your router with FileZilla Server (FZS) in order to fix the error code 425.
There is a Wiki on Network Configuration that covers this information, however, it is written in such a way that the “layman” may have difficulty understanding what’s going on—and it doesn’t show exactly how to fix the 425 error code—so this Wiki will give instructions on how to set up your specific router.

”Abstract”[edit]

This Wiki will go over the common technical reason(s) for error 425 being given after the FZS sends the 227 Passive command to the FTP client—regardless of what client is being used. This Wiki is written for the common user in a narrative tone—if a more in-depth technical Wiki is desired refer to the Network Configuration article.

Narrative[edit]

So, you’ve set up your FZS and it works for a local connection in your home, BUT you want to make your Local FTP Server accessible when you’re away—and you want to use encryption (FTP over TLS) to do so. You set up a Dynamic DNS (DynDNS) service to point to your FZS via your external IP address (don’t worry I’ll explain later in the Wiki). You’ve followed a how-to on setting up FZS to use TLS, but you’ve run into an issue—and after looking at the FZS Log you see the problem—right after the «227 Passive command» is given and acknowledged you see a 425 error. But even after summoning a Warlock, a Witch, and a Unicorn—you can’t fix it and wind up here reading this Wiki.

The Problem[edit]

More than likely the problem is that your FZS is requesting the FTP Client to use the Passive Ports defined in the FZS settings. And even though you’ve changed the settings in your Windows 7 or 8 Firewall you still can’t get your FTP Client to connect.
Why? Well it’s complicated; the type of encryption that FZS uses doesn’t allow the router to “see” that you’d like to allow this communication, and thus the router blocks the data from being transferred. There are other programs you can use that would allow the router to see that a computer requested the information to come in, but you’ve configured FZS thus far, and in many ways it’s better that no one knows what this data is at all—it is your private information after all.

Why the Router?[edit]

OK, so I know that this Wiki isn’t supposed to get too technical, but some of you might be curious as to how the router works, and why it’s doing what it is.

The Router is an important part in your Network security. Some say it’s the first line of defence against hacking and the last line of defence against Trojans/Viruses leaving with your private data—others say it’s a magic box connecting you to the world using sorcery—all of these are true.

The router takes one IP address and allows many devices to connect to the Internet using a complex protocol called Network Address Translation (NAT). Each time a computer requests information, such as going to “Google,” it puts it in a “packet” (think of an envelope) that the router opens, looks for an address, and then sends it to the Google web page, and in turn the Google web page sends a packet back with the information that opens up in your browser—only first the Router again opens the return packet to make sure that someone inside your private network requested it, and then sends it to the appropriate computer.

What if a packet comes in that no one requested? The Router puts it in the “trash”—in technical terms, the Router “drops” the packet. This keeps bad stuff out, and allows only what you’ve asked for to come in.

So what does this mean for this application? As stated above FZS uses an encrypted protocol to receive data. The Router can’t see that the encrypted data “packets” are “OK” to let in on the ports they are coming in on, and thus thinks that a hacker is trying to break in because those ports are closed.

At this point you can think whatever you want, like «well when I shut off the TLS portion of the service it works, so why don’t we change the type of encryption?» or whatever else you might come up with—but after all the work you’ve done so far, why give up now when there’s an easy fix? And there’s the pesky fact that you can’t change the type of encryption that FZS uses (what a drag…).

“So how do we know it’s the router?” You might ask. Take a look at the following Log, and the explanation below it.

Sample 425 error Log[edit]

According to your logs (Logs WILL vary so keep reading) you see:

  1. (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> Connected, sending welcome message…
    • (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> TLS connection established
    • (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> HOST **********.mooo.com
    • (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> 500 Syntax error, command unrecognized.
  2. (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> USER RCSTEST
    • (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> 331 Password required for rcstest
    • (000015)12/28/2013 20:43:55 PM — (not logged in) (72.174.118.74)> PASS *********
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> 230 Logged on
    • *Output Omitted*
  3. (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> AUTH TLS
    • *Output Omitted*
  4. (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> MKD Cobian Backup 11 test directory-2013-12-28 20;43;42
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> 257 «/Cobian Backup 11 test directory-2013-12-28 20;43;42» created successfully
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> CWD Cobian Backup 11 test directory-2013-12-28 20;43;42
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> 250 CWD successful. «/Cobian Backup 11 test directory-2013-12-28 20;43;42» is current directory.
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> PWD
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> 257 «/Cobian Backup 11 test directory-2013-12-28 20;43;42» is current directory.
    • *Output Omitted*
  5. (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> PROT P
    • (000015)12/28/2013 20:43:55 PM — rcstest (72.174.118.74)> 200 Protection level set to P
    • (000015)12/28/2013 20:43:56 PM — rcstest (72.174.118.74)> PASV
    • (000015)12/28/2013 20:43:56 PM — rcstest (72.174.118.74)> 227 Entering Passive Mode (84,25,240,74,206,88)
    • (000015)12/28/2013 20:43:56 PM — rcstest (72.174.118.74)> STOR Test file.txt
  6. (000015)12/28/2013 20:44:06 PM — rcstest (72.174.118.74)> 425 Can’t open data connection for transfer of «»
  7. (000015)12/28/2013 20:44:17 PM — rcstest (72.174.118.74)> QUIT
    • (000015)12/28/2013 20:44:17 PM — rcstest (72.174.118.74)> 221 Goodbye
    • (000015)12/28/2013 20:44:17 PM — rcstest (72.174.118.74)> disconnected.

So here’s what’s going on:

  1. The FTP Client (Cobian Backup 11 in this case) is establishing a connection with the FZS using standard ports 21 (non-encrypted) or 990 (encrypted) depending on your setup.
  2. The FTP Client is now providing the FZS with a username and password.
  3. The Server and client now establish that TLS must be used for further communication.
  4. The FTP Client is requesting that a folder be created. FZS creates the folder, etc. (boring stuff).
  5. Now FZS and the FTP Client enter Passive Mode (code 227)
    • The FZS tells the FTP Client that the passive ports are located at «(84,25,240,74,206,88).»
    • Decoded this translates to IP address 84.25.240.74 (the first four set of numbers) port number 52824 (the last two sets of numbers equated as: 206*256=52736, and 52736+88=52824 #Mathisfun).
  6. Here’s where the 425 «error» is given
  7. This last bit is what’s frustrating you, the connection is ending without any data being transferred…

Again, your output will vary in all aspects.

We Found the Problem, Now What?[edit]

The Fix: In the router you’ll need to open these ports for the encrypted traffic.
Now on to the exciting part if you have no idea how to do this! Look for your brand of router below, if it’s not listed ask me to list it, and I’ll do my best!

DynDNS Explained[edit]

  • Note: You’ll want to pay close attention here.

So what about this whole “DYNDNS” thing? For those of you who don’t know what this is, it’s a service that you can set up to point internet traffic to your computer when your external IP address is “Dynamic” or changes from time to time—as is the case with most public IP Addresses given by your Internet Service Provider (ISP). The set-up of such service “can” be free with a little work, but this falls outside the scope of this article at this time, another article will explain this in the future.

External IP Address[edit]

Your external IP address is the address given to you by your ISP. It should not in any way resemble your server’s IP address, or the IP address of any computer on your network.
For the purpose of this Wiki we will not address the Subnet Masks, as it’s not relevant to this topic.

Internal vs. External IP Address[edit]

The internal “Private” IP address of a Network “usually” starts with 192.168.X.X (where “X” can vary), and is assigned to your computer(s) so they can talk to the Internet via the external “Public” IP address. The external address can be anything in all reality, for this Wiki we’ll pretend the outside address is 84.25.240.74.

Device Specific Instructions[edit]

Please send a request for your device to be added if you don’t see it, and we’ll do our best to add it.

Apple Airport Extreme[edit]

  1. Under the Network tab of the Airport Utility there’s a section titled «port settings.»
  2. Click the «+» button to add a setting, either select «FTP access» from the dropdown, or add it.
  3. Under both «Private TCP ports» and «Public TCP Ports» put in 21 (standard FTP Port).
    • Note: You do NOT need to allow UDP ports as they are not used for FTP.
  4. Under Private IP address type the IP address of the destination computer (FTP server).
    • Note: setting a static IP address on the FTP server is strongly suggested.
  5. Repeat step 3 and allow port 990 (standard TLS port).
  6. Repeat step 3 one last time and
    • Under the TCP ports fill in the range of the FZS passive ports: i.e. «60000-65000» just like that.
    • Use your FZS ports. No spaces, no other characters.
  7. Apply the settings to the router, and allow it to reset.
  8. Test the connection.

I am using windows server + Xampp 1.8.3 and install FileZilla FTP Server => All configurations are ok!
But when I change default FTP’s port (21) to another port (30), it alerts:

STATUS:>    [17/04/2014 8:54:08 SA] Connecting to FTP server... xxx.xxx.xxx.xxx:30 (ip = xxx.xxx.xxx.xxx)...
STATUS:>    [17/04/2014 8:54:08 SA] Socket connected. Waiting for welcome message...
        [17/04/2014 8:54:08 SA] 220-FileZilla Server version 0.9.41 beta
        220-written by Tim Kosse (Tim.Kosse@gmx.de)
        220 Please visit http://sourceforge.net/projects/filezilla/
STATUS:>    [17/04/2014 8:54:08 SA] Connected. Authenticating...
COMMAND:>   [17/04/2014 8:54:08 SA] USER admin
        [17/04/2014 8:54:09 SA] 331 Password required for admin
COMMAND:>   [17/04/2014 8:54:09 SA] PASS *****
        [17/04/2014 8:54:09 SA] 230 Logged on
STATUS:>    [17/04/2014 8:54:09 SA] Login successful.
COMMAND:>   [17/04/2014 8:54:09 SA] SYST
        [17/04/2014 8:54:09 SA] 215 UNIX emulated by FileZilla
STATUS:>    [17/04/2014 8:54:09 SA] Host type detected: Unix.
COMMAND:>   [17/04/2014 8:54:09 SA] PWD
        [17/04/2014 8:54:09 SA] 257 "/" is current directory.
STATUS:>    [17/04/2014 8:54:09 SA] Home directory: /
STATUS:>    [17/04/2014 8:54:09 SA] This site supports features.
STATUS:>    [17/04/2014 8:54:09 SA] This site supports SIZE.
STATUS:>    [17/04/2014 8:54:09 SA] Setting up character encoding.
COMMAND:>   [17/04/2014 8:54:09 SA] OPTS UTF8 on
        [17/04/2014 8:54:09 SA] 200 UTF8 mode enabled
STATUS:>    [17/04/2014 8:54:09 SA] Using UTF-8.
STATUS:>    [17/04/2014 8:54:09 SA] This site can resume broken downloads.
COMMAND:>   [17/04/2014 8:54:09 SA] REST 0
        [17/04/2014 8:54:09 SA] 350 Rest supported. Restarting at 0
COMMAND:>   [17/04/2014 8:54:09 SA] PORT 192,168,1,111,207,240
        [17/04/2014 8:54:09 SA] 200 Port command successful
COMMAND:>   [17/04/2014 8:54:09 SA] LIST
        [17/04/2014 8:54:09 SA] 150 Opening data channel for directory list.
ERROR:>     [17/04/2014 8:54:40 SA] Timeout (30000 ms) occurred on accepting data connection from server.
        [17/04/2014 8:54:41 SA] 425 Can't open data connection.
        [17/04/2014 8:56:21 SA] 421 Connection timed out.
ERROR:>     [17/04/2014 8:56:21 SA] Control connection closed.

I opened port 20,21,30.

Brian Tompsett - 汤莱恩's user avatar

asked Apr 17, 2014 at 2:09

NaeN's user avatar

Port 20 is used as a source port for data connections in active mode (the on you use here) if the server listens on the default port 21. According to RFC959, 3.2 the default source port of the server for data connections is L-1, e.g. if L is 30 like in your case the source port should be 29 and no longer 20 so you have to allow connections from port 29.

answered Apr 17, 2014 at 4:30

Steffen Ullrich's user avatar

Steffen UllrichSteffen Ullrich

110k10 gold badges129 silver badges167 bronze badges

4

Also check your hosts file on windows for invalid entries. Had a help desk person with an old entry in their hosts file to the wrong ftp server and they were getting a 425.

answered Aug 24, 2017 at 13:43

Corey Manshack's user avatar

http://www.trapstone.com/articles/windows_ftp_425_connection_refused

Having problems transferring files with FTP?If you are using the command line FTP client within Windows and getting errors like these…

500 Illegal PORT command 425 Unable to build data connection: Connection refused

Well, don’t worry – you’re in good company.
This is probably one of the most commonly encountered problems by Windows users with the command line FTP client, primarily when connecting to servers that use non-default ports.
This article explains why … and what you can do about it.
Illegal Port Command – Why FTP may be running on a non-standard port
Every day, countless attempts are made to get access to servers via FTP by guessing account names and passwords.
As a result, many companies who provide FTP access to their customers have configured their servers to run FTP on a non-standard port (i.e. anything other than the default port 21).
Normally this should not be a problem, as you can tell your FTP client which port to connect to on the server and to use passive mode. If you don’t know what passive mode is all about, take a look at the article on Active FTP vs. Passive FTP.
Why Windows FTP Can’t Build A Data Connection
If you use the standard FTP client (the command line one) that comes bundled with Microsoft Windows, then you will find that even if you specify a different port number, you cannot enable passive mode.
Note also that you can’t specify the port number on the command line itself as a server.name:port pair (unlike pretty much every other command line FTP client on the planet).
Instead, you can only attempt this from within the client interactively. For example, here’s a session from an attempt to connect to one of our FTP servers which is running on port 7021…

Here we can see our attempt to connect to our server on it’s non-standard port is successful.
However, as soon as we attempt to transfer data, the attempt to open a secondary port for the data flow fails. Microsoft’s own article on the Windows FTP Client Receives Error Message 425 points out that:

“The FTP clients that ship with Windows do not support passive mode. Therefore, they always need to negotiate a data port when issuing a command that returns data.”

As a result, even if you do correctly specify a non-default port number, you still cannot use passive mode.
Sigh… cheers guys.
Note that you may find a lot of articles on the ‘net claiming that Windows FTP client does support passive FTP – often because they’ve seen the PASV entry in the registry or because the client appears to accept the literal pasv command.
It does not work with the Windows command line FTP client!
The server might respond to a PASV command with a message saying it is in passive mode but the Windows command line client has silently ignored it.
How You Can Use Passive FTP Under Windows
Internet Explorer can support passive mode as an FTP client if you enable it in the “Internet Options”, although that’s only useful for retrieving files – you can’t upload via Internet Explorer.
For full bidirectional FTP functionality, the simple answer is to not use the Windows command line FTP client at all.
We recommend that you use something like FileZilla, which provides a clear, friendly and useful interface – and it’s free!. Alternatively, Firefox users can get the FireFTP add-on to integrate bi-directional FTP with their browser.
If security is a concern and if the FTP server supports SSH connections, you may also want to download SFTP, which is part of the PuTTY SSH client distribution. This is also free and FileZilla supports SFTP as an alternative backend.

Read More:

  • Remove From My Forums
  • Question

  • In our application we are trasnfering files form MFP client to FTPServer(our application).
    This transfer is done for first scan.
    For the second scan it is showing «425 can’t open data connection error».
    Once the PC is restarted,it is working fine for again for first transfer.
    I think the problem may be realated to some socket close.

    we are using the followinf comamnds:
    USER
    PWD
    CWD 
    TYPE I
    PORT
    STOR
    QUIT.
    After STOR command,error is shown.It is unable to create Dataconnection from second scan onwards.

    I anyone knows share…it

Answers

  • It sound like you need to capture the cookie returned in the first response and add the cookie to the second request or you are not adding all the headers to the 2nd request.  I would use a sniffer like wireshark or fiddler to capture the http/ftp commands
    and look at the headers.  Compare the 1st request with the 2nd request. 


    jdweng

    • Marked as answer by

      Thursday, April 17, 2014 1:47 AM

All of my computer are behind a single router. I have a FileZilla server running on one of them. I am trying to automate an upload to the server using a batch script and Window’s built-in ftp.exe. I have set up a dynamic DNS service to be able to access my server from outside the router and I have set up port forwarding in the router to my server. I can connect and transfer just fine using Google Chrome, Windows Explorer, and the FileZilla client. However, whenever I try using ftp.exe (either manually or in batch script) I can connect to the server but if I try doing anything that would open a data connection (LIST, STOR, or RETR) I get the following error: 425 Can’t open data connection. I have allowed ftp.exe in both computer’s firewalls. Any ideas what is going on or how I could fix it? I don’t need to use ftp.exe if anyone knows of a portable independent (just an exe with no other files) command line client.

EDIT I know that my ISP blocks many ports including 21 and several others in that range. This is all set up on port 2121, with the passive ports set up to be 2122-2142, all of these have been forwarded in the router. Perhaps ftp.exe will only use a certain port for data connection, which my ISP blocked? If so how would I change this?

asked Apr 13, 2012 at 11:41

Garrett's user avatar

GarrettGarrett

4162 gold badges6 silver badges14 bronze badges

Regular active FTP uses a separate server-initiated data connection for transfers and only uses the regular port 21 connection as the control channel. When the client is behind a firewall, however, the firewall is likely to block this connection. I’m guessing Chrome, Explorer, FireZilla, etc. are smart enough to try passive mode, in which the original client-initiated connection is used as both the control and data channel.

It appears that Windows’ default CLI FTP client doesn’t support passive mode. So you’ll need to switch to NcFTP. Alternatively, and I think probably the better option, is just to use SFTP instead. FTP is insecure and really only to be used on LANs. SFTP is fully encrypted and also only uses a single channel for data and commands. If you need a CLI SFTP client, PSFTP is a good option.

answered Apr 13, 2012 at 11:55

Lèse majesté's user avatar

Lèse majestéLèse majesté

3,2391 gold badge18 silver badges23 bronze badges

8

I had this problem as well. The solution was stop the firewall of the antivirus (in my case the McAfee), it was blocking the ports of FTP.

answered Jan 14, 2014 at 13:06

Sfalcini's user avatar

1

Windows FTP CLI does support PASSIVE mode. Use «quote pasv» to enter into passive mode.

answered Jun 13, 2012 at 15:53

George Rios's user avatar

1

Понравилась статья? Поделить с друзьями:

Читайте также:

  • 424 ошибка http
  • 424 comment processing error
  • 423c bios error
  • 423 ошибка http
  • 4223 ошибка мерседес актрос

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии