2

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.

1
  • Like Frederik said, you can never be 100% sure. There are only 65535 ports to choose from, and a zillion (real number!) applications out there all trying not to run on the same port number as each other.
    – jwbensley
    Sep 5, 2012 at 20:46

2 Answers 2

1

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.

1
  • Thanks - that's the key bit of info I had missed... that just by listening on a port no other application will then try to use that port. So, by using a port from the dynamic range, as long as it is free when I start up sshd, then I can be confident it will not by hijacked by anything else (assuming anything else conforms to RFC6335, I suppose).
    – rowatt
    Sep 6, 2012 at 7:25
3

You can never ever be 100% sure that a certain port is never used on any system - that is simply not possible.

However, if you check your environment, you should be able to find a port(range) that is not being used by anything else, and use a port in that range.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.