← All cheatsheets

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

SSH22Secure shell + scp/sftp. The first port to harden (key-only).
HTTP80Unencrypted web; usually just redirects to 443.
HTTPS443TLS web — the default for anything public.
DNS53Name resolution. UDP for queries, TCP for large answers/zone transfers.
PostgreSQL5432Relational DB. Never expose to the public internet.

The three port ranges

The three TCP/UDP port ranges Ports 0–1023 are well-known (need root to bind), 1024–49151 are registered, and 49152–65535 are dynamic/ephemeral (used for outbound connections). 0–1023 well-known 1024–49151 registered (apps pick these) 49152–65535 dynamic / ephemeral (outbound) root required to bind ↓ your client's source port ↓

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 / protocolPortNotes
SSH / SFTP / SCP22Secure shell and file transfer. Harden: key-only, no root.
HTTP80Plaintext web. Redirect to 443 in production.
HTTPS443TLS web. The one public port most services need.
DNS53UDP for lookups; falls back to TCP for big responses.
SMTP / submission25 / 58725 = server-to-server relay; 587 = authenticated client send (465 = implicit TLS).
IMAP / IMAPS143 / 993Mailbox sync. 993 is TLS — prefer it.
NTP123Time sync (UDP). Clock skew silently breaks TLS and auth tokens.
LDAP / LDAPS389 / 636Directory auth. 636 is TLS.
SNMP161 / 162Device monitoring (UDP); 162 receives traps.
RDP3389Windows remote desktop. Never expose raw — gateway/VPN only.
MySQL / MariaDB3306Relational DB. Bind to private network.
MSSQL1433SQL Server.
Redis6379In-memory store. No auth by default — never expose publicly.
MongoDB27017Document DB. Historically exposed with no auth — don't.
Memcached11211Cache. Unauth UDP is a DDoS reflector — bind to localhost.
AMQP / RabbitMQ5672Message broker (15672 = management UI).
Elasticsearch9200HTTP/JSON API (9300 = node transport). Lock it down.
Kubernetes API6443kube-apiserver over HTTPS.
Prometheus9090Metrics server + query UI.
HTTP-alt / dev8080Proxies, app servers, and local dev. Not special — just convention.
HTTPS-alt8443Alt TLS (Tomcat, appliances, dashboards).
NFS2049Network 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 free

Troubleshooting — symptom → first check → next check

SymptomFirst checkEstablishesNext check
Address already in usesudo lsof -i :PORTWhich PID already holds the portStop that process, or bind a different port
Connection refusednc -vz HOST PORTNothing is listening (vs filtered)Start the service; check it binds 0.0.0.0, not 127.0.0.1
Connection timed outnc -vz HOST PORTFiltered by a firewall / security group, not refusedOpen the port in the firewall / cloud SG
Permission denied bindingecho PORT # is it < 1024?Ports below 1024 need root or CAP_NET_BIND_SERVICEUse a high port behind a reverse proxy, or grant the capability
Reachable locally, not remotelyss -tlnp | grep PORTBound to 127.0.0.1 (loopback) onlyBind 0.0.0.0 and then firewall it deliberately
Port open but no/garbled replycurl -v HOST:PORTWrong protocol (http vs https) vs a hung appMatch the protocol; then check the app's own logs

References

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.