These posts appeared in a Google digest but do not appear in the archives.

Here are the posts and my response:

FTP transfer port
-----------------

Gary Larson - Jan 29 10:58 pm

When I run a MVS batch FTP to port 21, the data is actually transferred on a 
port number in the range of 1024-4096.  Why?

---

Bill Lalond aka "Big Iron" - Jan 29 11:30 pm

By default, the FTP server "listens" for client connections on its port 21. The 
port numbers used on the client side by FTP running in batch are usually 
different from the port numbers used on the FTP server side. After the FTP 
server receives a connect request from a 
client, it will establish a separate control connection and data connection 
with 
the client. 

See http://www.ietf.org/rfc/rfc959.txt for the gory details of the FTP 
standard which applies to all FTP implementations.

---

Gary

A little abrupt in your "listiquette" aren't you?

A question styled more along the lines of "Would someone kindly explain why 
this is so?" would be more acceptable. You could even add "TIA" although I 
prefer the use of a separate post for a "thanks" *after* the answer has been 
provided rather than the rather arrogant presumption - IMHO - that an answer 
will be forthcoming - but that's just a personal foible! 

Your question reads as if you thought you knew it all and for some inexplicable 
reason it's not quite according to your education. For that reason I'm going to 
cover the basics.

Bill's not quite completely right so I hope he'll excuse me starting from first 
principles.

A traditional use of the FTP protocol is for an FTP client to set up a TCP 
connection to an FTP server. In this connection there are two ports involved:

The *server* port associated with the server IP address, the destination 
fields in packets flowing from the client to the server including clearly the 
initial one, your "to port 21", is indeed port 21[1].

The *client* port associated with the client IP address, the source fields in 
packets flowing from the client to the server, is an ephemeral port which, on 
your system, appears to have been configured as 1024-4096, the lower limit 
being the usual one and the upper limit being close to the usual one adopted - 
according to the web page I used to check this - by BSD.

However, what you need to take on board is that this is *not* the TCP 
connection over which the actual data transfer takes place. This connection 
is the one used for the FTP commands you use to set up and initiate your 
transfers - whether by immediate or delayed finger-power, i.e. 
whether "interactive" or "batch" - the responses to those commands. In fact, 
this connection used for commands and responses uses a protocol very similar 
to that used by TELNET I believe.

A separate connection is established when you enter "get" or "put" commands 
or equivalents. Traditionally this connection uses port 20 on the server side 
and an ephemeral port on the client side. There are some firewall-
dodging "tricks" used to make this process more amenable to operation with a 
firewall - which I'll let others cover if they feel inclined.

Note that whether the FTP command is entered with a keyboard into a PC 
window or is read as a batch file makes not one iota of difference. As far as 
the FTP protocol is concerned it is the FTP client. This is to deal with your 
emphasis on running FTP in "batch".

Now to justify my minor unhappiness with Bill's response.

> By default, the FTP server "listens" for client connections on its port 21.

Correct.

> The port numbers used on the client side by FTP running in batch are 
usually different from the port numbers used on the FTP server side.

Remove the "usually". Traditional "well-known" port numbers, used by 
traditional server applications such as FTP, TELNET and so on, lie in the range 
1-1023 and ephemeral port numbers steer clear of this "well-known" range. 
Thus the "difference" is absolute.

> After the FTP server receives a connect request from a client, it will 
establish a separate control connection and data connection with the client.

Potentially a bit confusing. The server side completes the "control" connection 
initiated by the client side when the FTP command is entered. The 
separate "data" connections are established when necessary.

Or maybe I've been carrying misapprehensions around with me for some time 
also ...

However I remember well having to correct time and time again - when 
AnyNet Sockets over SNA[2] was all the rage and going to sweep the IP-
centric world off its feet - documentation and presenters giving examples of 
how to associate SNA APPN COS names with server ports which/who said 
#INTER should be associated with port 23, TELNET, and, of course, #BATCH 
should be associated with port 21, FTP. "Rubbish"!!! Port 21 also needs to be 
associated with #INTER and port 20, the actual data transfer port, with 
#BATCH.

Chris Mason

[1] Unless you've set up the server deliberately to use another port number 
perhaps for testing or because it's to be used for secure traffic - although my 
preferred technique is to set up different VIPAs - with different DNS names - 
for different functions while keeping traditional port numbers, in this case 21.

[2] *Not* AnyNet SNA over IP which towards the end of its existence was 
abbreviated to simply AnyNet as if there were no other flavours of AnyNet.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to