ftp blocked?

awangus

Member
Joined
Oct 9, 2003
Messages
24
I have a client with new ADSL connection and Telkom ISP just as I have. I can get into ftp sites but he cannot.

I take my notebook there and have the same as from their systems. I set up both Netgear routers and they are exactly same model/settings. No problems at all with http protocol.

So I wonder if Telkom restrict the ftp protocol on that user? After 30 min hanging on the line, have given up on asking them directly. They tell such lies anyway that the call and time would probably be wasted.

Anybody with same experience or knowledge about this?
 

BTTB

Executive Member
Joined
Feb 6, 2004
Messages
8,195
Is it Telkom's port shaping?
It would be nice if Podo could lend some light to this discussion as I have the same problem uploading files to the ftp server of my website and the server sits in CT.

I would also like some answers.

<b><hr noshade size="1"></b><font size="2"><font color="red"><b>You can take Telkom out of the Post Office but you can't take the Post Office out of Telkom.</b></font id="red"></font id="size2">
 

podo

Well-Known Member
Joined
Apr 16, 2004
Messages
288
I should start a web site and charge for all the answers... AskPodo.com [8D]

Seriously though, this is quite odd, since if it works at one site, it should work just fine at another site with exactly the same equipment. There are some possibilities though.

Generally, FTP will not work correctly from behind a normal NAT. This is because an FTP connection is actually two connections. First, your client establishes a TCP connection to port 21 of the FTP server. This connection is known as the controle connection. Once up, the controle connection is used to send commands to the server. In cases where the server need only respond to a command, the response is sent back across the controle connection.

In cases where the server needs to respond with data, it gets a little bit more interesting. When data needs to be sent to the client, following commands like ls, which lists all files in the directory, or GET commands which instruct the server to send a file, another connection needs to be opened.

The client sends a PORT command to the server, which tells the server the client's IP address. After the PORT command, the FTP server establishes a new TCP connection back to the client, on port 20. This is the data connection. Once the data connection is open, data is sent through it to the client.

During the data transfer, the client and server use the controle connection for signalling and status messages.

Here we find a two-fold problem:

Firstly, with a client behind a NAT, the client will always send the server the IP address which it believes it is at. In the case of machines behind a NAT, this will be a private address.

Receiving the PORT command, the server will do one of two things, it will either try to connect to the private address, if that address happens to exist on its own network and nothing will happen, since there is no FTP client running on the machine which has that address, from the point of view of the server.

Alternatively, the server could recognise the address as private and just give up right away. Either way, your data won't be getting through. In the first case, there will be a long time-out followed by an error message.

Secondly, if the client did manage to send the FTP server the correct outside address of the NAT, there would still be no data connection, since the FTP server would be connecting back directly to port 20 on the NAT machine and there is no FTP client running on the NAT. Again, no connection.

A way has been devised to get around this problem, in the form of the PASV command, which initiates "passive" mode FTP. In passive mode, no data connection is established. Instead, data is transmitted back to the client through the controle connection. This has some drawbacks as no signalling is possible while data is traveling, but it is the only reliable way to FTP through most NATs, so it is accepted by most servers.

Some NAT servers also perform proper FTP NATing. This implies watching the controle connection of any FTP session from a machine behind the NAT. When the NAT sees a packet carrying a PORT command, the packet is altered so that the NAT's address is sent to the server, not the machine's internal address.

When the FTP server connects back to the NAT, traffic on port 20 of the NAT's external interface is forwarded to port 20 on the internal machine. In this way, the data connection can make it through the NAT. This is a little bit limited though, as there can be only one FTP session at a time. For more FTP sessions, more external interfaces need to be available on the NAT. If the NAT were to have multiple interfaces, the limit would change from one session, to one session per external interface.

Obviously, "passive" mode FTP is the best way to work around this problem, but it comes with its own drawbacks. To take advantage of passive mode, your FTP client must allow it. "Client-in-a-browser" clients generally do not know about the PASV command, especially Internet Explorer. In order to use passive mode, you will have to install a third party FTP client and use it for all FTP uploads and downloads.

Incidentally, uploads also use the data connection.

If installing real FTP clients and teaching your users how to use them is not an option, you might want to look at an FTP proxy.

This is fairly simple. Find a slightly underutilised UNIX or Windows NT machine on your network and install the appropriate version of the Squid proxy software. Set up Squid's internal FTP proxy to always use PASV when connecting to FTP servers. Then, set up each machine to use Squid as an FTP proxy. In this way, all FTP connections will be converted into PASV sessions and your FTP sessions should be able to traverse the NAT without any problems.

As a side note, there are also some NAT solutions, which, for no aparent reason, break passive mode FTP. These are NAT system which insist that FTP should be done in the traditional way, meaning a dual-connection session. These NAT systems are badly designed, since they force the use of the "one session only" kind of FTP NAT. If you are currently using PASV, try turning it off and see if it helps. If so, you have a "stupid" NAT.

Willie Viljoen
Web Developer

Adaptive Web Development
 

Andre

Expert Member
Joined
Aug 12, 2003
Messages
1,121
I've been meaning to try out ftp'ing to the office for a while to test upload speed, so have just tried it and got about 44k from a 3Meg file.

This was from my home DSL to the office DSL. Netgear 814 routers at both ends.

Running Windows XP at home and SBS 2003 at the office. Both machines have Squid. FTP works with upload and download using either command line FTP or IE6.
 

antowan

Honorary Master
Joined
Nov 1, 2003
Messages
13,054
You guys might want to try switching between passive and active FTP to see which one fits your connecting server best.

http://slacksite.com/other/ftp.html

He who does not understand the value of war at the right time, cannot comprehend the value of life at any time - Anonymous
 

Karnaugh

Banned
Joined
Jul 23, 2003
Messages
1,575
Forcing open ports 49152-65535 works for me

The problem is NAT firewalls cant percieve the incoming traffic because there has been no syn/ack negotiation for them. Like podo said you connect to port 21 as the controlling connection, the server them throws oodles of data back at you on random ports with in the range above and the firewall hasnt seen a connection established to those ports and closes them

- Colin Alston
colin at alston dot za dot org

"Getting traffic shaping right is easy and can be summed up in one word: Dont." -- George Barnett
 
Top