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.

I am about to write tcp-server for a project my company is working on. The server will use several port for different tasks. During development we use just some portnumber we like: 1400, 1500, 1600-1650.

Could we use this ports on our production server? Or are there some security and / or compatibility issues we have to think about?

share|improve this question

5 Answers 5

up vote 8 down vote accepted

As mentioned by Paul, ports <1024 are generally reserved for 'core' services. (Also, many operating systems require services that bind to ports <1024 to be run as root).

However, there are other ports that are commonly in use. The IANA Port number list is normally a good place to look; you should try and avoid using any port on there that is already reserved. Although, practically, this only makes a difference if you are going to be using a service that has a reserved port within your network/on your servers, checking this list is a good habit to get in to whenever you are developing a new network application.

share|improve this answer

Do not design your software to use any port below 49152 by default, since these are reserved by IANA (even those unassigned). The user may be able to set a port manually during configuration. If you have to ship the software with a default port preconfigured, use some port from the range 49152 through 65535.

share|improve this answer

Anything over 1024 should be fine, if not used by anything else on your production servers.

However, why not make it configurable? Have the ports defined in a configuration file / or directory or something, then if you do have a clash, it's just a quick edit to change it to something else.

Also, this technique allows you to run more than one instance on the same machine (if you have everything that more than one application/process needs defined in the config file - this might include message queue ids, directory names and so on). Our current product doesn't do this, and it's a pain in the proverbial.

share|improve this answer
1  
+1 Configurable ports is strongly encouraged. –  Zoredache May 24 '09 at 20:58
1  
we have configurable ports... but the configurations still must be written for the production server... –  TheHippo May 25 '09 at 12:05

I've had trouble using port 2000 for some things. The problem was a virus used that port a long time ago and some routers/firewalls/etc are suspicious of data on the port. I started to default the port numbers to above 30,000.

share|improve this answer

Simply any port number between 1025 and 65535. The ports below 1024 are reserved for various things basically for OS oriented tasks. Ex 25 for SMTP, 23 for Telnet, 80 for HTTP, 443 for HTTPS likewise.

You must be careful to get a port that is not used by another service, program as well.

share|improve this answer
    
Not true, there are lots of ports above 1024 that are reserved by IANA (see Murali Suriar's answer). Port numbers above 49152 are not reserved. –  Graeme Perrow May 24 '09 at 18:24
    
Hi Graeme, They are NOT the ports used by OS. They are for custom applications. IANA has published them just for reference. –  Chathuranga Chandrasekara May 24 '09 at 18:36
1  
Chathuranga, Ports above 1024 may or may not be used by operating system services, but they are reserved. From the link above: "The Registered Ports are those from 1024 through 49151 DCCP Registered ports SHOULD NOT be used without IANA registration. The registration procedure is defined in [RFC4340], Section 19.9." –  Murali Suriar May 24 '09 at 19:39
    
It is for permanant registrations right? As an example you are going to release your own application and you are using port 1521 then it will make a conflict with Oracle. Other than that no problem with using any port for local applications.. iana.org/assignments/port-numbers –  Chathuranga Chandrasekara May 25 '09 at 6:34

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.