Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 '12 at 20:46

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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 '12 at 7:25

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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