Connection problem over NAT firewalls.

To the Ipswitch web site

Ipswitch Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Connection problem over NAT firewalls.Expand / Collapse
Author
Message
Posted 7/26/2004 7:56:48 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/2/2004 12:00:00 PM
Posts: 2, Visits: 1

Hi All!

I'm hoping that someone can help me with an annoying connection problem I'm having...

The problem
-----------

I'm having a problem using the Secure SDK to connect to an WS_FTP server.
The problem is that the SDK functions always give the error "425 Can't open data connection" when I try to list the contents of an FTP directory.
WS_FTP Pro, however, works fine.

Software Versions
-----------------

The WS_FTP Server is version 5.01 (with the latest July patch).
The WS Secure SDK is the latest version.
The Server operating system is Windows 2000 Server.
The Client operating system is Windows XP or Windows 2000 Professional (it fails on both).
Both the Server AND the client machines are behind NAT firewalls.

FTP Settings
------------

The significant settings for the WS_FTP Server are as follows:

General System Settings: FTP Port = 1961
Firewall options: IP Address = left blank. Port Range = 1962-1969
SSL: Enable SSL = checked, Force Clients to use SSL Connections = checked, Force Clients to use 128-bit or higher on this host = checked.


More Details
------------

Like I already said, it works fine if you use WS_FTP PRO to access the FTP directory (note: there is no firewall configuration selected for WS_FTP PRO).
The SDK also works if the client does NOT use a NAT firewall, i.e. if you go directly onto the Internet or via Zone Alarm it works fine!
This leads me to conclude that the problem is related to using a NAT firewall on the client. However, the fact that WS_FTP PRO works WITHOUT you having to specify any firewall details should mean that the SDK should also work!

Code
----

Here is the C# code that fails through a NAT firewall:

using FTP = WsftpSDK ;

FTP.WsftpApiClass ftp = new WsftpSDK.WsftpApiClass();

FTP.WsftpConnection connex = ftp.CreateConnection
(
    "ftp.ouraddress.com",
    "account",
    "*******",
    (int)FTP.WsftpConnectionTypes.WSFTP_CT_FTPAUTHSSL,
    1961
);

FTP.WsftpFolder folder = connex.GetFolder( "*", "/SymphonetData" );
folder.Refresh();
string file_list = "File list:\r\r" ;

for (  int i = 0, n = folder.Count  ;  i < n  ;  ++i  )
{
    FTP.WsftpItem item = folder.get_Item(i);
    file_list += item.Name + "\r" ;
}

MessageBox.Show( file_list );   // File list is always empty.
connex.Disconnect();


Comments on the code
--------------------

If I look at connex.LastServerResponse immediately after the call to connex.GetFolder(), it says:
"425 Can't open data connection."
Then folder.Count is zero (even though the folder contains many items).

Logs
----

Comparing the WS_FTP_PRO logs and the not-working SDK logs seems to point to the culprit being the SDK's inability to substitute a connection address for a private address.

===========================
Working log from WS_FTP PRO
===========================

PWD
257 "/SymphonetData" is current directory
TYPE A
200 Type set to ASCII.
PASV
227 Entering Passive Mode (10,0,0,3,7,170).
connecting data channel to 10.0.0.3:7,170(1962)
Substituting connection address 195.173.199.130 for private address 10.0.0.3 from PASV
data channel connected to 195.173.199.130:7,170(1962)
MLSD
150 Opening ASCII data connection for directory listing
transferred 1171 bytes in < 0.001 seconds, 9148.438 Kbps ( 1143.555 Kbps), transfer succeeded.
226 transfer complete

=====================================
Not working log from SDK test program
=====================================

[2004.07.23 14:20:05.638] PWD
[2004.07.23 14:20:05.654] 257 "/SymphonetData" is current directory
[2004.07.23 14:20:05.669] TYPE A
[2004.07.23 14:20:05.685] 200 Type set to ASCII.
[2004.07.23 14:20:05.685] PASV
[2004.07.23 14:20:05.700] 227 Entering Passive Mode (10,0,0,3,7,177).
[2004.07.23 14:20:05.700] connecting data channel to 10.0.0.3:7,177(1969)
[2004.07.23 14:20:26.666] PORT 192,168,12,155,5,6
[2004.07.23 14:20:26.682] 200 command successful
[2004.07.23 14:20:26.682] MLSD *
[2004.07.23 14:20:49.647] 425 Can't open data connection.
[2004.07.23 14:20:49.772] PORT 192,168,12,155,5,7
[2004.07.23 14:20:49.788] 200 command successful
[2004.07.23 14:20:49.788] MLSD
[2004.07.23 14:21:12.726] 425 Can't open data connection.
[2004.07.23 14:21:15.242] QUIT
[2004.07.23 14:21:15.273] 221 Good-Bye


Note the line from the working WS_PRO that says "Substituting connection address 195.173.199.130 for private address 10.0.0.3 from PASV".
There seems to be no equivalent in the SDK version.


I'm well and truly stuck at this point! Any help would be most appreciated!

Post #376
Posted 7/29/2004 6:27:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/2/2004 12:00:00 PM
Posts: 2, Visits: 1

My thanks go out to the support team, who have resolved this issue within 2 days of me sending an email! Excellent service - to be commended. Thanks!

Post #469
Posted 8/24/2004 5:03:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 8/24/2004 5:02:00 PM
Posts: 1, Visits: 1

Support,

Can you answer if this is now fixed in the SDK so we may decide to purchase.  We need the ability to force the IP for automation purposes, if it does work now, we will purchase.

I have left messages with Support regarding this as well, but haven't heard back.  I appreciate your assistance in this matter.

Thank you,

Jason

Post #965
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Dave, Mark Singh, kevin r gillis, Jason Benton, Brandon Felger, Ben Henderson, Tripp Allen, Will Sansbury, Hush, FTPplanet.com, Hugh Garber, WUP-PM, mmulryan@ipswitch.com, mswimm

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:27pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 10 queries. Compression Enabled.