Answer the question
In order to leave comments, you need to log in
What is the best TCP port to use for tcp/ip server on linux?
Hello.
I am writing a tcp/ip server under linux. It will listen on 3 ports and work 24/7, so there should be no overlap with other programs that can use ports from this range.
Therefore, the question arises: what ports can you use for your server?
From the wiki:
All ports are divided into three ranges - well-
known (or system, 0-1023),
registered (or user, 1024-49151)
and dynamic (or private, 49152-65535).
The range 49152-65535 contains dynamically allocated or private ports that are not registered with IANA. These ports are used for temporary (short-lived) client-server connections or in certain special cases.
Answer the question
In order to leave comments, you need to log in
Your server - take any port that you are not going to occupy with something else. The only caveat is that in Linux, by default, unprivileged users cannot bind to ports below 1024.
Or better, make some kind of default and the ability to change it.
I would clarify that ports that are scanned and brute-forced should not be used - so that your programs are not forced to respond to hackers' attempts to break into your system. An example list is:
According to RFC standards, any between 1024-49151
or in the range from 1024 to 49151, for example, 1025, 1026, 1027, 2029, 33252, and so on, up to at least 11111
and dynamic (or private, from 49152 to 65535, their router may not miss
Increasing TCP port range with net.ipv4.ip_local_port_range
blog.sedicomm.com/2018/06/10/uvelichenie-diapazona...
Select any from 1000 to 65534, do not run tsp daemons on the server with the selected port
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question