Ephemeral port explained

An ephemeral port is a communications endpoint (port) of a transport layer protocol of the Internet protocol suite that is used for only a short period of time for the duration of a communication session. Such short-lived ports are allocated automatically within a predefined range of port numbers by the IP stack software of a computer operating system. The Transmission Control Protocol (TCP), the User Datagram Protocol (UDP), and the Stream Control Transmission Protocol (SCTP) typically use an ephemeral port for the client-end of a client–server communication. At the server end of the communication session, ephemeral ports may also be used for continuation of communications with a client that initially connected to one of the services listening with a well-known port. For example, the Trivial File Transfer Protocol (TFTP)[1] and Remote Procedure Call (RPC) applications can behave in this manner.

The allocation of an ephemeral port is temporary and only valid for the duration of the communication session. After completion of the session, the port is destroyed and the port number becomes available for reuse, but many implementations simply increment the last used port number until the ephemeral port range is exhausted, when the numbers roll over. Ephemeral ports are also called dynamic ports, because they are used on a per request basis, and are only known by number once allocated.

Range

Range Operating system
49152–65535 suggested by RFC 6335 and the Internet Assigned Numbers Authority (IANA) for dynamic or private ports.[2] [3] FreeBSD has used the IANA port range since release 4.6. Windows Vista, Windows 7, and Server 2008 use the IANA range by default.[4]
32768–60999 used by many Linux kernels.[5] [6]
32768–65535 used by Solaris OS and AIX OS.
1024–65535 RFC 6056 [7]
1025–60000 default of Windows Server 2008 with Exchange Server 2007 installed.[8] In addition to the default range, all versions of Windows since Windows 2000 have the option of specifying a custom range anywhere within 1025 - 65535.[9] [10]
1024–5000 FreeBSD versions before 4.6, including the Berkeley Software Distribution (BSD).[11] [12] Default range of Microsoft Windows operating systems through Windows XP.[13]
1025–5000 used by Windows Server 2003, until Microsoft security update MS08-037 from 2008 is installed, after which it uses the IANA range by default.[14]

Configuration characteristics

If certain server software is used, that uses non-ephemeral custom port ranges for initiating some further connections, it needs to be ensured by configuration that this custom port range and the ephemeral port range do not overlap.

See also

External links

Notes and References

  1. The TFTP Protocol (Revision 2) . 1350 . Karen R.Sollins . July 1992 . . 2020-10-18 .
  2. https://www.iana.org/assignments/port-numbers IANA port number assignments
  3. Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry . 6335 . Port Number Ranges . 6 . Cotton . M. . Eggert . L. . Touch . J. . Westerlund . M. . Cheshire . S. . August 2011 . the Dynamic Ports, also known as the Private or Ephemeral Ports, ... 49152-65535 (never assigned) . . November 14, 2021 . 10.17487/RFC6335.
  4. http://support.microsoft.com/kb/929851/ Microsoft KB Article 929851
  5. The effective range is accessible via procfs at node /proc/sys/net/ipv4/ip_local_port_range.
  6. Web site: IP Sysctl . The Linux Kernel documentation . 2021-06-27 . The default values are 32768 and 60999 respectively..
  7. 6056 . Recommendations for Transport-Protocol Port Randomization . 3.2. Ephemeral Port Number Range . M. Larsen . F. Gont . January 2011 . However, ephemeral port selection algorithms should use the whole range 1024–65535..
  8. http://support.microsoft.com/kb/929851 Microsoft KB Article 929851
  9. http://support.microsoft.com/kb/929851/ Microsoft KB Article 929851
  10. http://support.microsoft.com/kb/196271/ Microsoft KB Article 196271
  11. Book: UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI. Prentice Hall. 1998. 0-13-490012-X. 42–43.
  12. Web site: The Ephemeral Port Range . note that the Linux 2.4 kernel will default the range of 32768 through 61000 if adequate kernel memory is available . 2001 . Mike Gleason . 2018-01-15 .
  13. https://technet.microsoft.com/en-us/library/bb878133.aspx Microsoft Windows Technet Library
  14. http://support.microsoft.com/kb/956188/ Microsoft KB Article 956188