1 Service Name and Transport Protocol Port Number
Service names and port numbers are used to distinguish between different services that run over transport protocols such as TCP, UDP, DCCP, and SCTP. Service names are assigned on a first-come, first-served process, as documented in [RFC6335]. Port numbers are assigned in various ways, based on three ranges:
System Ports (0-1023),
User Ports (1024-49151),
Dynamic and/or Private Ports (49152-65535).
the difference uses of these ranges is described in [RFC6335].
System Ports are assigned by IETF process for standards-track protocols, as per [RFC6335].
User Ports are assigned by IANA using the "IETF Review" process, the "IESG Approval" process, or the "Expert Review" process, as per [RFC6335].
Dynamic Ports are not assigned. The registration procedures for service names and port numbers are described in [RFC6335]. Assigned ports both System and User ports SHOULD NOT be used without or prior to IANA registration.
2 查看端口范围及是否可用
the default port used by a service may fall within the defined local port range of a host. To check a host’s local port range:
$ sysctl net.ipv4.ip_local_port_range
If a service’s default port falls within this range, run the following program to check if the port has already been assigned to another application:
$ lsof -i :PORT
参考:
1 Service Name and Transport Protocol Port Number Registry: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml