0

In basic networking services, (e.g ssh) why we use statically assigned port number? What are potential problems with allowing services to select their own port in the applications provided by us?

2
  • 1
    This is pretty basic stuff. An admin can dynamically assign the port in most server applications. You could run your SSH service off port 12345 if you wanted. However, any client that doesn't allow users to select the port... or any user who doesn't know what port to use, will not be able to use your service. You could run SSH on port 80 if you wanted, too, or run your web server on port 22... at the risk of SSH clients or web servers using the default ports being very confused.
    – Smithers
    Apr 17, 2015 at 19:56
  • 2
    Known service has to be at a known location (port) for people to access it. It's like trying to shop at a mall that's never in the same place.
    – Ricky
    Apr 17, 2015 at 21:20

3 Answers 3

1

Ultimately you are free to do what you like but avoiding common ports is always a plus and stops conflicts of services.

0

Imagine the World Wide Web (www) without standardization of port [tcp] 80 for HTTP or 443 for HTTPS. Or email if SMTP wasn't typically found on port 25. How would browsers or mail servers know which port to use to reach the multitudes of servers littered all over the internet?

As @smithy2k3 noted, you can configure whatever port you want, assuming that port is communicated to the client somehow -- sneakernet or email come to mind -- and you're able to traverse your protocol through firewalls that may be inspecting the traffic on certain ports for rewrite -- FTP on tcp/21 and SIP on udp/5060, for example.

0

If you were to allow applications to select ephemeral port numbers at their own discretion, there would be no layer of security at the network level.

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