Network
Common Ports — the port numbers you're asked to name
The well-known TCP/UDP ports grouped by service, the three port ranges, and how to find and free a port that's already in use.
Docs-checkedportstcpudpnetworkservices
Quick reference — reach for these first
SSH
22Secure shell + scp/sftp. The first port to harden (key-only).HTTP
80Unencrypted web; usually just redirects to 443.HTTPS
443TLS web — the default for anything public.DNS
53Name resolution. UDP for queries, TCP for large answers/zone transfers.PostgreSQL
5432Relational DB. Never expose to the public internet.The three port ranges
Text equivalent: TCP/UDP ports split into three ranges: 0–1023 are well-known (binding one needs root or CAP_NET_BIND_SERVICE), 1024–49151 are registered and what most apps listen on, and 49152–65535 are dynamic/ephemeral — the OS assigns these as the source port for outbound connections.
Common tasks
Service / protocol · Port · Notes
| Service / protocol | Port | Notes |
|---|---|---|
| SSH / SFTP / SCP | 22 | Secure shell and file transfer. Harden: key-only, no root. |
| HTTP | 80 | Plaintext web. Redirect to 443 in production. |
| HTTPS | 443 | TLS web. The one public port most services need. |
| DNS | 53 | UDP for lookups; falls back to TCP for big responses. |
| SMTP / submission | 25 / 587 | 25 = server-to-server relay; 587 = authenticated client send (465 = implicit TLS). |
| IMAP / IMAPS | 143 / 993 | Mailbox sync. 993 is TLS — prefer it. |
| NTP | 123 | Time sync (UDP). Clock skew silently breaks TLS and auth tokens. |
| LDAP / LDAPS | 389 / 636 | Directory auth. 636 is TLS. |
| SNMP | 161 / 162 | Device monitoring (UDP); 162 receives traps. |
| RDP | 3389 | Windows remote desktop. Never expose raw — gateway/VPN only. |
| MySQL / MariaDB | 3306 | Relational DB. Bind to private network. |
| MSSQL | 1433 | SQL Server. |
| Redis | 6379 | In-memory store. No auth by default — never expose publicly. |
| MongoDB | 27017 | Document DB. Historically exposed with no auth — don't. |
| Memcached | 11211 | Cache. Unauth UDP is a DDoS reflector — bind to localhost. |
| AMQP / RabbitMQ | 5672 | Message broker (15672 = management UI). |
| Elasticsearch | 9200 | HTTP/JSON API (9300 = node transport). Lock it down. |
| Kubernetes API | 6443 | kube-apiserver over HTTPS. |
| Prometheus | 9090 | Metrics server + query UI. |
| HTTP-alt / dev | 8080 | Proxies, app servers, and local dev. Not special — just convention. |
| HTTPS-alt | 8443 | Alt TLS (Tomcat, appliances, dashboards). |
| NFS | 2049 | Network file system mounts. |
Worked example — 'address already in use' on 8080
FREE THE PORT
1
Find what already holds the port. lsof is clearest; ss works too.
sudo lsof -iTCP:8080 -sTCP:LISTEN -P -n
# or: ss -tlnp 'sport = :8080'
# node 41233 deploy ... TCP *:8080 (LISTEN)2
Decide: is that process meant to be running? If it's a stale dev server, stop it; if it's a real service, pick a different port instead.
kill 41233 # graceful (SIGTERM)
# kill -9 41233 # only if it ignores SIGTERM
# port released✓
Confirm the port is free, then start your service. A clean nc means nothing is listening yet.
nc -vz localhost 8080 # 'refused' = free
# Connection refused -> good, port is freeTroubleshooting — symptom → first check → next check
| Symptom | First check | Establishes | Next check |
|---|---|---|---|
| Address already in use | sudo lsof -i :PORT | Which PID already holds the port | Stop that process, or bind a different port |
| Connection refused | nc -vz HOST PORT | Nothing is listening (vs filtered) | Start the service; check it binds 0.0.0.0, not 127.0.0.1 |
| Connection timed out | nc -vz HOST PORT | Filtered by a firewall / security group, not refused | Open the port in the firewall / cloud SG |
| Permission denied binding | echo PORT # is it < 1024? | Ports below 1024 need root or CAP_NET_BIND_SERVICE | Use a high port behind a reverse proxy, or grant the capability |
| Reachable locally, not remotely | ss -tlnp | grep PORT | Bound to 127.0.0.1 (loopback) only | Bind 0.0.0.0 and then firewall it deliberately |
| Port open but no/garbled reply | curl -v HOST:PORT | Wrong protocol (http vs https) vs a hung app | Match the protocol; then check the app's own logs |
References
- IANA Service Name and Port Number Registryiana.org
- RFC 6335 — port ranges (well-known / registered / dynamic)rfc-editor.org
- ss(8) — socket statisticsman7.org
- lsof(8) — list open files/socketsman7.org
Ports follow the IANA registry; a few (3000, 8080, 9000) are convention, not assignment. Checks assume Linux (ss/lsof) or macOS (lsof). HOST/PORT are placeholders.