How should I select the port number for a new tool?

Jace Browning asked:

I’m creating an internal collaboration tool that will use a central server (on an intranet) and one or more ports for socket communication to clients. I know that many ports are reserved for particular purposes and others are conventionally used for certain types of traffic.

How should I go about picking a default port that is least likely to have been “claimed” by someone else for their tool? Is there a database that identifies all known (even unconventional) port usage?

My answer:

Yes, IANA maintains the official service and port number registry.

The process for getting a port number assigned to you is documented in RFC 6335. A review process is required for any port assignment, but it is much stricter for ports < 1024; such assignments require (among other things) that your protocol is documented in an RFC.

(Note that this process is relatively new and that there are many assigned ports which were grandfathered in.)

For < 1024, ports 1021 and 1022 are reserved for experimentation; above that, for experimentation you can simply use a dynamic port >= 49152.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.