Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So why did FTP have 21 and telnet have 23?


The convention early on was apparently to have odd destination ports and even source ports, compared to using random high port numbers for source ports nowadays. As such, when the earliest protocols were being developed, they weren't giving out odd port numbers, but by the time ssh requested it they were.

https://www.quora.com/Why-does-Telnet-use-port-23


It was more than just convention. I believe that was how one of the TCP predecessors (the name of which I forget) worked.



FTP has port 21 and port 20.


FTP's use of two ports is unusual. Port 21 is used for the control channel and port 20 for data transfer. Its original design goes back to 1971 and predated TCP/IP by quite a bit.

In the original design ("passive" mode wasn't added till later), the client connects to a server on port 21 and then when it wants to transfer a file, opens a local port and the server connects back to the client from port 20. Also, FTP supported server-to-server transfers, where the client connected to a pair of servers and then initiated a transfer between them[0].

[0] https://tools.ietf.org/html/rfc765 Figure 2.


Looking in /etc/services, it seems that most early protocols used odd numbers on the server side (echo, finger, chargen, qotd, etc)

I wonder if the standard was originally

Client -> Server -- send to an odd port Server -> Client -- send to an even port

By the time RFCs reached 4 figures, that (if it did exist) had gone -- gopher was assigned to port 70 for example.


It’s apparently due to hysterical raisins. The NCP host-host protocol was simplex and required a pair of sockets. The convention for the return socket was to connect to a “port” one less than the receiving port. At least I think. See the connection establishment process described starting on page 7 of https://tools.ietf.org/html/rfc33


Thanks, something I hadn't encountered:

"On January 1, 1983, known as flag day, NCP was officially rendered obsolete when the ARPANET changed its core networking protocols from NCP to the more flexible and powerful TCP/IP protocol suite, marking the start of the modern Internet."

I was 13 months old then, and (After conversations at tonight's summer party) I'm apparently "old". Sigh.

> hysterical raisins

Took a while to realise you went for "historical reasons". But then see summer party (and tomorrow's P45)....


Also, DHCP uses 2 ports, but that is UDP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: