Ports and Protocols
The well-known ports worth having memorized - what runs there, and why.
| Port | Transport | Protocol / Service |
|---|---|---|
| 20 / 21 | TCP | FTP - data (20) and control (21) |
| 22 | TCP | SSH (and SFTP/SCP over it) |
| 23 | TCP | Telnet - unencrypted, effectively legacy-only |
| 25 | TCP | SMTP - mail relay between servers |
| 53 | UDP/TCP | DNS - UDP for ordinary queries, TCP for zone transfers and large responses |
| 67 / 68 | UDP | DHCP - server (67) and client (68) |
| 80 | TCP | HTTP |
| 110 | TCP | POP3 |
| 123 | UDP | NTP |
| 143 | TCP | IMAP |
| 161 / 162 | UDP | SNMP - agent queries (161) and traps (162) |
| 179 | TCP | BGP |
| 443 | TCP/UDP | HTTPS (TCP for HTTP/1.1 and HTTP/2, UDP for HTTP/3 over QUIC) |
| 445 | TCP | SMB - Windows file/printer sharing |
| 465 / 587 | TCP | SMTP submission - implicit TLS (465) and STARTTLS (587) |
| 3306 | TCP | MySQL |
| 5432 | TCP | PostgreSQL |
| 6379 | TCP | Redis |
| 8080 / 8443 | TCP | Common alternate HTTP / HTTPS (dev servers, proxies, app servers) |
| 27017 | TCP | MongoDB |
Port ranges
Every port number falls into one of three ranges, assigned by IANA:
| Range | Name | Notes |
|---|---|---|
| 0-1023 | Well-known | Requires root/admin privilege to bind on most OSes; reserved for standard services (HTTP, SSH, DNS, ...) |
| 1024-49151 | Registered | Vendors register these with IANA for specific applications (e.g. 3306 MySQL, 5432 Postgres), but binding them needs no special privilege |
| 49152-65535 | Ephemeral / dynamic | Never assigned to a service; the OS picks from this range for the client side of an outgoing connection |
The server listens on a fixed, well-known port (say 443). The client's source port for that connection is an ephemeral one, picked by the OS from the dynamic range and released when the connection closes. A single client host can therefore have thousands of simultaneous connections to the same server port, distinguished by the client's ephemeral port in each socket's 4-tuple.