Calculate maximum concurrent socket connections a server can support.
Each IP address exposes 65,535 usable TCP port numbers (1-65535; port 0 is reserved), so the theoretical maximum socket count scales linearly with the number of local IP addresses available. In practice, outbound (client-initiated) connections draw from a narrower ephemeral port range — the IANA-recommended range is 49152-65535 (16,384 ports), though many Linux distributions default to a wider 32768-60999 range — since well-known (0-1023) and registered (1024-49151) ports are reserved for services and specific applications rather than transient outbound connections.
Max sockets
max_sockets = IPs × 65535
Ephemeral ports per IP
ephemeral_ports = ephemeral_end − ephemeral_start + 1 (16,384 for IANA range 49152-65535)
Ports 1024-49151 are the 'registered' range, reservable by IANA for specific applications and protocols (avoiding collisions for well-known but non-privileged services) — the ephemeral range starting at 49152 is set aside specifically for transient, client-side outbound connections that don't need a fixed, registered port number.
This is a long-standing Linux kernel default (configurable via net.ipv4.ip_local_port_range) that predates or diverges from the IANA recommendation, providing a similarly-sized pool of around 28,000 ports — the exact range doesn't matter much for capacity as long as it doesn't overlap with ports used by listening services on the same host.
Since a socket is uniquely identified by the 4-tuple of (local IP, local port, remote IP, remote port), the same local port can be reused simultaneously for connections to different remote endpoints — so adding more local IP addresses, or connecting to more distinct remote endpoints, both increase effective outbound capacity beyond what the ephemeral port count alone would suggest for a single remote destination.