Which TCP ports to use?

rowatt asked:

Is there a TCP port range which I can be sure will not be used by anything else for traffic between two machines?

If I am reading RFC6335 correctly, I can be sure that no other applications will use specific ports in the Dynamic/Private/Ephemeral range of 49152-65535. However, if I understand correctly, it also states (section 8.1.2) that an application shouldn’t assume that any given port in that range is available at any given time, which would mean I can’t be 100% sure that it will be unused all the time.

Specifically, I want to assign specific SSH traffic to a different port for the security benefit and so I can classify it differently for QoS purposes, and not have to worry about changing the port in the future.

My answer:


Once a service is started and listening on a port, no other program will be able to bind to that port number. So start your service on whatever port you want; you have nothing to worry about.


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.