Port
A port is a 16-bit number identifying one endpoint of a transport connection, so a single address can carry many independent conversations at once.
A port is a 16-bit number identifying one endpoint of a transport connection, so a single address can carry many independent conversations at once. A connection is identified by the pair of addresses together with the pair of ports and the protocol.
#The three ranges
RFC 6335 divides the 16-bit space into three parts, and IANA maintains the registry of assignments.
| Range | Name | Assignment |
|---|---|---|
| 0–1023 | System, or well known | Assigned by IANA, stricter review |
| 1024–49151 | User, or registered | Assigned by IANA on request |
| 49152–65535 | Dynamic, private or ephemeral | Never assigned; used for outbound connections |
A registered assignment is a convention, not enforcement. Any service may listen on any port it can bind.
#Ports as a proxy control surface
Many providers use the port number on a single gateway hostname to select behaviour: which country the exit node is in, whether the address rotates per request, or which sticky session you attach to. This is a vendor convention with no standard behind it, so the mapping differs between providers and can change. Read the documentation for the endpoint you actually hold.
Where the same behaviour is available both by port and by username parameters, prefer whichever your client can vary per request. Some HTTP clients cache connections per host and port, which quietly changes what rotation means.
#Running out of them
Each outbound connection consumes a source port on the originating address, drawn from the ephemeral range. High concurrency from one machine to one destination can exhaust that range, and connections in a closing state hold their port for a period afterwards. The symptom is connection failures that arrive suddenly at a threshold and do not look like anything the target did.
#Commonly confused with
Port forwarding publishes an internal service outward. CONNECT asks a proxy to open an outbound connection to a host and port on your behalf. Both involve a port; only one of them is under the destination’s control.