by kragen | 2025-11-15 20:58:12+00:00
DNS postdated port numbers.

Mockapetris's DNS RFCs are from 01983, although I think I've talked to people who installed DNS a year or two before that. Port numbers were first proposed in RFC 38 in 01970 https://datatracker.ietf.org/doc/html/rfc38

> The END and RDY must specify relevant sockets in addition to the link number. Only the local socket name need be supplied

and given actual numbers in RFC 54, also in 01970 https://datatracker.ietf.org/doc/html/rfc54

> Connections are named by a pair of sockets. Sockets are 40 bit names which are known throughout the network. Each host is assigned a private subset of these names, and a command which requests a connection names one socket which is local to the requesting host and one local to the receiver of the request.

> Sockets are polarized; even numbered sockets are receive sockets; odd numbered ones are send sockets. One of each is required to make a connection.

In RFC 129 in 01971 we see discussion about whether socketnames should include host numbers and/or user numbers, still with the low-order bit indicating the socket's gender (emissive or receptive). https://datatracker.ietf.org/doc/html/rfc129

RFC 147 later that year https://datatracker.ietf.org/doc/html/rfc147 discusses within-machine port numbers and how they should or should not relate to the socketnames transmitted in NCP packets:

> Previous network papers postulated that a process running under control of the host's operating system would have access to a number of ports. A port might be a physical input or output device, or a logical I/O device (...)

> A socket has been defined to be the identification of a port for machine to machine communication through the ARPA network. Sockets allocated to each host must be uniquely associated with a known process or be undefined. The name of some sockets must be universally known and associated with a known process operating with a specified protocol. (e.g., a logger socket, RJE socket, a file transfer socket). The name of other sockets might not be universally known, but given in a transmission over a universally known socket, (c. g. the socket pair specified by the transmission over the logger socket under the Initial Connection Protocol (ICP). In any case, communication over the network is from one socket to another socket, each socket being identified with a process running at a known host.

RFC 167 the same year https://datatracker.ietf.org/doc/html/rfc167 proposes that socketnames not be required to be unique network-wide but just within a host. It also points out that you really only need the socketname during the initial connection process, if you have some other way of knowing which packets belong to which connections:

> Although fields will be helpful in dealing with socket number allocation, it is not essential that such field designations be uniform over the network. In all network transactions the 32-bit socket number is handled with its 8-bit host number. Thus, if hosts are able to maintain uniqueness and repeatability internally, socket numbers in the network as a whole will also be unique and repeatable. If a host fails to do so, only connections with that offending host are affected.

> Because the size, use, and character of systems on the network are so varied, it would be difficult if not impossible to come up with an agreed upon particular division of the 32-bit socket number. Hosts have different internal restrictions on the number of users, processes per user, and connections per process they will permit.

> It has been suggested that it may not be necessary to maintain socket uniqueness. It is contended that there is really no significant use made of the socket number after a connection has been established. The only reason a host must now save a socket number for the life of a connection is to include it in the CLOSE of that connection.

RFC 172 in June https://datatracker.ietf.org/doc/html/rfc172 proposes using port 3 for the second version of FTP:

> [6] It seems that socket 1 has been assigned to logger. Socket 3 seems a reasonable choice for File Transfer.

This updates the first version in RFC 114 in April https://datatracker.ietf.org/doc/html/rfc114 which said:

> [16] It seems that socket 1 has been assigned to logger and socket 5 to NETRJS. Socket 3 seems a reasonable choice for the file transfer process.

RFC 196 the same year https://datatracker.ietf.org/doc/html/rfc196 proposes to use port 5 to receive mail and/or print jobs:

> Initial Connection will be as per the Official Initial Connection Protocol, Documents #2, NIC 7101, to a standard socket not yet assigned. A candidate socket number would be socket #5.

In RFC204 in August https://www.rfc-editor.org/rfc/rfc204.html Postel publishes the first list of port number assignments:

> I would like to collect information on the use of socket numbers for "standard" service programs. For example Loggers (telnet servers) Listen on socket 1. What sockets at your host are Listened to by what programs?

> Recently Dick Watson suggested assigning socket 5 for use by a mail-box protocol (RFC196). Does any one object ? Are there any suggestions for a method of assigning sockets to standard programs? Should a subset of the socket numbers be reserved for use by future standard protocols?

> Please phone or mail your answers and commtents to (...)

Amusingly in retrospect, Postel did not include an email address, presumably because they didn't have email working yet.

FTP's assignment to port 3 was confirmed in RFC 265 in November:

> Socket 3 is the standard preassigned socket number on which the cooperating file transfer process at the serving host should "listen". (*)The connection establishment will be in accordance with the standard initial connection protocol, (*)establishing a full-duplex connection.

In May of 01972 Postel published a list as RFC 349 https://www.rfc-editor.org/rfc/rfc349.html:

> I propose that there be a czar (me ?) who hands out official socket numbers for use by standard protocols. This czar should also keep track of and publish a list of those socket numbers where host specific services can be obtained. I further suggest that the initial allocation be as follows:

Sockets Assignment 0-63 Network wide standard functions 64-127 Host specific functions 128-239 Reserved for future use 240-255 Any experimental function

> and within the network wide standard functions the following particular assignment be made:

Socket Assignment 1 Telnet 3 File Transfer 5 Remote Job Entry 7 Echo 9 Discard

Note that ports 7 and 9 are still assigned to echo and discard in /etc/services, although Telnet and FTP got moved to ports 23 and 21, respectively.

tcpmux 1/tcp # TCP port service multiplexer echo 7/tcp echo 7/udp discard 9/tcp sink null discard 9/udp sink null systat 11/tcp users daytime 13/tcp daytime 13/udp netstat 15/tcp qotd 17/tcp quote chargen 19/tcp ttytst source chargen 19/udp ttytst source ftp-data 20/tcp ftp 21/tcp fsp 21/udp fspd ssh 22/tcp # SSH Remote Login Protocol telnet 23/tcp

So, internet port numbers in their current form are from 01971 (several years before the split between TCP and IP), and DNS is from about 01982.

In December of 01972, Postel published RFC 433 https://www.rfc-editor.org/rfc/rfc433.html, obsoleting the RFC 349 list with a list including chargen and some other interesting services:

Socket Assignment 1 Telnet 3 File Transfer 5 Remote Job Entry 7 Echo 9 Discard 19 Character Generator [e.g. TTYTST] 65 Speech Data Base @ ll-tx-2 (74) 67 Datacomputer @ cca (31) 241 NCP Measurement 243 Survey Measurement 245 LINK

The gap between 9 and 19 is unexplained.

RFC 503 https://www.rfc-editor.org/rfc/rfc503.html from 01973 has a longer list (including systat, datetime, and netstat), but also listing which services were running on which ARPANet hosts, 33 at that time. So RFC 503 contained a list of every server process running on what would later become the internet.

Skipping RFC 604, RFC 739 from 01977 https://www.rfc-editor.org/rfc/rfc739.html is the first one that shows the modern port number assignments (still called "socket numbers") for FTP and Telnet, though those presumably dated back a couple of years at that point:

Specific Assignments: Decimal Octal Description References ------- ----- ----------- ---------- Network Standard Functions 1 1 Old Telnet [6] 3 3 Old File Transfer [7,8,9] 5 5 Remote Job Entry [10] 7 7 Echo [11] 9 11 Discard [12] 11 13 Who is on or SYSTAT 13 15 Date and Time 15 17 Who is up or NETSTAT 17 21 Short Text Message 19 23 Character generator or TTYTST [13] 21 25 New File Transfer [1,14,15] 23 27 New Telnet [1,16,17] 25 31 Distributed Programming System [18,19] 27 33 NSW User System w/COMPASS FE [20] 29 35 MSG-3 ICP [21] 31 37 MSG-3 Authentication [21]

Etc. This time I have truncated the list. It also has Finger on port 79.

You say, "My understanding is that DNS can potentially provide port numbers, but this is not widely used or supported." DNS SRV records have existed since 01996 (proposed by Troll Tech and Paul Vixie in RFC 2052 https://www.rfc-editor.org/rfc/rfc2052), but they're really only widely used in XMPP, in SIP, and in ZeroConf, which was Apple's attempt to provide the facilities of AppleTalk on top of TCP/IP.