Why should registered port numbers not be used as public ports? [duplicate]
Registered Ports (1024 - 49, 151) are port numbers that gets registered with IANA for public use.
Assume I have a popular application like discord, running on some port using a different protocol named 'xxx'.
- Do I have to register the port number for IANA?
- If not then what's the purpose to register a port number in IANA if everybody can use any port and in which case a port conflict occurs?
- Why does a port conflict occurs when port numbers are used publicly?
- If a port is registered , then how one knows if it's registered already or if it's unregistered, is there any database for it?
Any practical examples will be helpful to understand.
Solution 1:
There is a common misconception about the IANA port registration.
The only reason this list exists is to avoid conflicts with well-known software.
Nothing stops you from using any one port from the list if you have not installed the software that uses it by default. And even then, you may set that software to use another port (if possible).
I wouldn't advice installing a web-server on your computer and using port 80 for something else beside serving web-pages, but you certainly can, as long as you know what you are doing. This is many times done on purpose, see for example Honeypot.