Ports & Sockets
ss -tn on a machine serving traffic prints dozens of rows, and every one shows 10.0.0.5:443 on the left with a different address on the right. One slot, dozens of live conversations, and the right column is why.
- ▸One server holds thousands of live connections on one slot, because the four numbers naming each still differ.
- ▸Two servers can share the same number on one machine, as long as each binds its own specific local address.
- ▸Stop a server that closed its own connections, and its address can stay unusable for about a minute.
You start a web server and tell it to listen on 443. That number is nothing special to the wire: it is one value in a 16-bit field, so it runs 0 to 65535 and no further.
The values split into three bands. System ports, 0 to 1023, are the ones the operating system guards: on Linux, by default, a program cannot claim 1 to 1023 without root or a specific capability, and asking for 0 makes the kernel pick a free port above them. User ports, 1024 to 49151, any program may take. Dynamic ports, 49152 to 65535, IANA (the body that keeps the official port registry) never hands to anyone; they are left for temporary, local use.
The guard on the low band is not written in the number. The operating system enforces it, and a different system can draw the line in a different place.