Definition

dynamic port numbers

What are dynamic port numbers?

The dynamic port numbers (also known as the private port numbers) are the port numbers that are available for use by any application to use in communicating with any other application, using the internet's Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP).

What are dynamic private ports?

A port can be either hardware-based or software-based. A hardware-based port is a physical interface -- such as a jack or socket -- for connecting with other systems. A software-based port -- sometimes referred to as a virtual port -- is a logical communication endpoint that's managed by the host's operating system (OS). Software-based ports are numbered and can be assigned to specific processes or services. The host computer uses these ports to direct traffic to the associated process or service.

Software-based ports are identified by 16-bit integers that range from 0 to 65535. The ports can be either static or dynamic. A static port is one whose association with a process or service does not change. A dynamic port -- also called a private port -- is one that is assigned to a process or service at the time the port is needed, usually when the process or service is started. When assigning dynamic ports, the OS can use any ports available from the range of ports designated for this purpose.

Whether a port is static or dynamic, it's always associated with a protocol, usually TCP or UDP. Incoming connections must specify the correct port number in order to connect to the application or service, unless the port is implied by the type of communication.

For example, port 80 is reserved for communications that use Hypertext Transfer Protocol (HTTP). When users connect to a web application that uses port 80, they do not need to specify the port number in the Uniform Resource Locator (URL) because it's implied. However, if the web application uses a port other than 80, the port number must be added to the end of the URL, preceded by a colon, as in www.techtarget.com:443.

TCP vs. UDP networking protocols
Using the internet's Transmission Control Protocol or User Datagram Protocol, dynamic port numbers enable applications to communicate with each other.

How do dynamic port numbers work?

A port is identified by its port number. If the port is associated with a process or service, the port number also identifies that process or service. For this reason, when an application on one host computer communicates with an application on a different computer, the calling application usually specifies the target application's port number in each data transmission.

For example, the TCP header in an Internet Protocol packet transmitted over the internet includes both the source port and the destination port.

If an application knows the destination port number, it can call the number directly. If it does not know the port number, the application can use one of several methods to determine the number, such as querying the domain name system service records or making a system call that looks up the port number based on the service name.

The port numbering system has been standardized across the internet and provides a mechanism for registering service names and assigning port numbers. The Internet Assigned Numbers Authority (IANA) maintains this system, although the Internet Corporation for Assigned Names and Numbers now manages most IANA functions. That said, the port numbering functions are still presented as IANA services.

The port numbering system is described in Request for Comments (RFC) 6335, an Internet Engineering Task Force publication. RFC 6335 includes details about service name usage and port registries, as well a breakdown of the port number ranges. In addition to TCP and UDP, the port numbering system also applies to UDP-Lite, Stream Control Transmission Protocol and Datagram Congestion Control Protocol.

The registries for these protocols are divided into three categories, based on the available range of numbers (0 to 65535):

  1. System ports, also known as well-known ports, include ports 0 to 1023 and support commonly used services.
  2. User ports, also known as registered ports, include ports 1024 to 49151 and are assigned to specific services, based on service applications submitted to IANA.
  3. Dynamic ports, also known as private or ephemeral ports, include ports 49152 to 65535 and are never assigned.

At any given time, a system or user port exists in one of the following three states:

  1. The port is currently assigned to a service, and the assignment is recorded in the registry.
  2. The port is available for assignment upon request. The request requirements are outlined in RFC 6335. IANA assigns port numbers on a first-come, first-served basis.
  3. IANA has reserved the port for special purposes.

Examples of system and user ports include the following:

Dynamic port numbers exist in a category separate from the other two because they can never be assigned or reserved. IANA has specifically set aside the port numbers in the dynamic range for local, private or temporary use, leaving it up to the host computers and application software to determine how and when to use these ports. However, application developers should not assume that a specific port number in the dynamic range will always be available.

This was last updated in August 2021

Continue Reading About dynamic port numbers

Dig Deeper on Network infrastructure