Skip to content
Search

Port

lastmod 2024-02-26created 2016-01-079 edits

For other meanings (homonym), see MacPort

TCP and UDP ports are virtual logical communication endpoints used by transport layer protocols of the Internet protocol suite, such as TCP and UDP. Each port is identified by a number, called the port number. Port numbers are used together with IP addresses by the corresponding protocol.

Well-known port number

Well-known ports are a subset of TCP and UDP port numbers assigned by IANA for specific uses. In general, port numbers can be divided into three ranges:

  • 0 - 1023: well-known ports
  • 1024 - 49151: registered ports
  • 49152 - 65535: dynamic ports - this range is probably(?) the ephemeral ports...

On most Unix-like operating systems, root privileges are required to open a well-known port. These numbers are not mandatory; they are only IANA's recommendations. Sometimes port numbers are used for purposes other than their assigned ones. In such cases, programs like Trojan horses may change ports for malicious purposes.

Wikipedia description:

The registered ports are those from 1024 through 49151. IANA maintains the official list of well-known and registered ranges.

The dynamic or private ports are those from 49152 through 65535. One common use for this range is for ephemeral ports. 

Ephemeral port

An ephemeral port is a short-lived port number used by an Internet Protocol (IP) transport protocol. Ephemeral ports are allocated automatically from a predefined range by the IP stack software. An ephemeral port is typically used by the Transmission Control Protocol (TCP), User Datagram Protocol (UDP), or the Stream Control Transmission Protocol (SCTP) as the port assignment for the client end of a client–server communication to a particular port (usually a well-known port) on a server.

Dynamic port range

Following command will list the ephemeral port range in Linux system

sysctl -A | grep ip_local_port_range 

If we don't want to reboot, after editing /etc/sysctl.conf file if we execute following command it will be effective.

sysctl -p /etc/sysctl.conf .

The truth of the matter of effective range is output of

sysctl net.ipv4.ip_local_port_range 

as mentioned by eckes in comment.

Finding open port numbers

See Port scanner#Example of finding open port numbers for details.

See also

Favorite site

References


  1. List_of_tcp_and_udp_port_numbers.pdf ↩

author Zer0 sitemap