Ephemeral ports are ports that are typically used by custom applications, or for temporary connections.
For example, when you connect to a website on port 443, you are making a TCP connection, and you need to connect via port on your system. This is where the term Random High Ports (RHP) come in. Your operating system will determine an RHP in the range that has been pre-defined by your operating system) to complete this TCP connection with the website you are using.
The Internet Assigned Numbers Authority (IANA) suggests the range 49152 to 65535* for usage as a RHP.
Linux RHP’s range from ports 32768 to 60999.
Windows uses ports 1025–5000.
On Linux, any port under 1024, is considered a reserved port, and you must have root privileges to utilize ports 1-1023 on Linux.
Registered ports are broken down into 2 categories, “well-known” or “system” ports and “user” or “registered” ports.
Ports 0–1023 – system or well-known ports
Ports 1024–49151 – user or registered ports
It is good practice to avoid using the well-known port range (0-1023), for your custom applications, as you are very likely to run into a conflict with another program trying to use one of these ports.
For custom applications, stick with ports 1024–49151, or if you want to throw up a quick or dynamic connection, you can use 49152–65535.