An ephemeral port is a dynamically selected client source port numbered 49152 through 65535. IANA does not control these ports, so registration is unnecessary. section 22.1.1
Use ephemeral ports to understand connection endpoints and session tracking:
- A client selects an ephemeral source port when connecting to a server’s destination port. section 22.1.1
- TCP and UDP use port numbers to address application processes; source and destination IP addresses plus ports distinguish sessions. section 22.3
- Remember the range: well-known ports are 0–1023, registered ports are 1024–49151, and ephemeral ports are 49152–65535. section 22.1.1
Client-to-server exchange
PC1 sends a TCP segment from source port 50000 to SRV1 on destination port 443. SRV1 replies from port 443 to port 50000. section 22.1.1
Figure 22.2 PC1 sends a TCP segment to SRV1. The segment is sourced from port 50000 on PC1 and destined for port 443 on SRV1. SRV1’s reply reverses the ports: it is sourced from port 443 on SRV1 and destined for port 50000 on PC1.
Trace how an ephemeral client source port becomes the destination port for the server’s reply. section 22.1.1
