Skip to main content

Ports and Protocols

The well-known ports worth having memorized - what runs there, and why.

PortTransportProtocol / Service
20 / 21TCPFTP - data (20) and control (21)
22TCPSSH (and SFTP/SCP over it)
23TCPTelnet - unencrypted, effectively legacy-only
25TCPSMTP - mail relay between servers
53UDP/TCPDNS - UDP for ordinary queries, TCP for zone transfers and large responses
67 / 68UDPDHCP - server (67) and client (68)
80TCPHTTP
110TCPPOP3
123UDPNTP
143TCPIMAP
161 / 162UDPSNMP - agent queries (161) and traps (162)
179TCPBGP
443TCP/UDPHTTPS (TCP for HTTP/1.1 and HTTP/2, UDP for HTTP/3 over QUIC)
445TCPSMB - Windows file/printer sharing
465 / 587TCPSMTP submission - implicit TLS (465) and STARTTLS (587)
3306TCPMySQL
5432TCPPostgreSQL
6379TCPRedis
8080 / 8443TCPCommon alternate HTTP / HTTPS (dev servers, proxies, app servers)
27017TCPMongoDB

Port ranges

Every port number falls into one of three ranges, assigned by IANA:

RangeNameNotes
0-1023Well-knownRequires root/admin privilege to bind on most OSes; reserved for standard services (HTTP, SSH, DNS, ...)
1024-49151RegisteredVendors register these with IANA for specific applications (e.g. 3306 MySQL, 5432 Postgres), but binding them needs no special privilege
49152-65535Ephemeral / dynamicNever assigned to a service; the OS picks from this range for the client side of an outgoing connection
Ephemeral ports are the client's, not the server's

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.

0%0 of 63 pages studied