Network & delivery
10 min readUpdatedWhat is a port? TCP and UDP ports, port ranges and a common ports list
Quick answer
A port is a 16-bit number, from 0 to 65535, in every TCP and UDP header that tells the receiving host which program a packet belongs to: the IP address finds the machine, the port finds the service. IANA divides the numbers into well-known ports (0 to 1023), registered ports (1024 to 49151) and dynamic or ephemeral ports (49152 to 65535). TCP and UDP keep separate port spaces, so TCP 53 and UDP 53 are different sockets.
01What is a port in networking?
A port is a number that identifies one endpoint of a conversation on a host. The IP header carries source and destination addresses, which get a packet to the right machine; the TCP or UDP header carries a 16-bit source port and destination port, which get it to the right program on that machine. Sixteen bits give 65,536 values, 0 to 65535.
A server program asks the operating system to bind a socket to an address and port, for example TCP 443 on every address, and then listens. A client that connects picks a temporary port of its own, so each TCP connection is identified by five values: protocol, source address, source port, destination address and destination port. That 5-tuple is why one web server on port 443 can hold thousands of connections at once: each differs in the client's address or port.
The word also names a physical socket on a switch or router. This page is about the logical port of TCP and UDP, which lives in the transport layer of the TCP/IP model.
02TCP ports vs UDP ports: are they the same?
No. TCP and UDP keep separate port spaces. TCP 53 and UDP 53 are two different sockets, and a DNS server opens both. IANA usually registers a number for the same service on both protocols, but not always: in its registry TCP 514 is the old rsh "shell" service while UDP 514 is syslog, and TCP 520 is "efs" while UDP 520 is the RIP routing protocol.
The two protocols also behave differently when nothing is listening, which is how port scanners tell open from closed:
| Port state | TCP answer | UDP answer |
|---|---|---|
| Open (a program listens) | SYN-ACK: the handshake can complete | Whatever the application replies, or nothing at all |
| Closed (nothing listens) | RST: the connection is refused at once | ICMP port unreachable, which RFC 1122 says a host SHOULD send |
| Filtered (a firewall drops it) | No reply; the client times out | No reply, which looks the same as an open port that stays silent |
03Well-known, registered and ephemeral port ranges
RFC 6335 (BCP 165, August 2011) divides the 65,536 numbers into three ranges, shown in the table below, and IANA keeps the registry of which service holds which number. Port 0 is reserved; a program that binds to port 0 asks the operating system for any free port.
Operating systems add rules of their own. On Linux, binding below 1024 needs root or the CAP_NET_BIND_SERVICE capability, because ip_unprivileged_port_start defaults to 1024. Client ports come from each system's own ephemeral range, which is not always the IANA one: Linux uses 32768 to 60999 by default (ip_local_port_range), while Windows has used 49152 to 65535 since Windows Vista and Server 2008, up from 1025 to 5000 before.
| Range | Name in RFC 6335 | Used for |
|---|---|---|
| 0 to 1023 | System Ports, also called well-known ports | Long-standing services such as 22 SSH, 25 SMTP, 53 DNS, 80 HTTP and 443 HTTPS; assigned by IANA under the strictest review |
| 1024 to 49151 | User Ports, also called registered ports | Applications that registered a number, such as 1433 SQL Server, 3306 MySQL, 3389 RDP and 5432 PostgreSQL |
| 49152 to 65535 | Dynamic Ports, also called private or ephemeral ports | Never assigned; meant for temporary client ports and private use |
04How to see which ports are listening on a server
On Linux, ss -tulpn lists every listening TCP and UDP socket with the process that owns it: t for TCP, u for UDP, l for listening, p for the process and n for numbers instead of service names. Run it with sudo to see processes of other users. The output below comes from an isolated test namespace in which a small script held six sockets.
Read the local address column first. 0.0.0.0 and [::] mean every IPv4 or IPv6 address on the host, including the public one; 127.0.0.1 means loopback only. In the example, PostgreSQL on 127.0.0.1:5432 cannot be reached from outside, while 0.0.0.0:53 can unless a firewall says otherwise. UDP sockets show UNCONN because UDP has no connections. On Windows, netstat -ano lists the same with process IDs. What an outsider sees is a separate test, because a firewall can hide a listening socket.
$ sudo ss -tulpn
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 0.0.0.0:53 0.0.0.0:* users:(("python3",pid=1234,fd=7))
udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("python3",pid=1234,fd=8))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("python3",pid=1234,fd=3))
tcp LISTEN 0 128 0.0.0.0:53 0.0.0.0:* users:(("python3",pid=1234,fd=6))
tcp LISTEN 0 128 127.0.0.1:5432 0.0.0.0:* users:(("python3",pid=1234,fd=4))
tcp LISTEN 0 128 [::]:443 [::]:* users:(("python3",pid=1234,fd=5))
# one port only, without the header line
$ sudo ss -Htlnp 'sport = :22'
# an established connection: the client side uses an ephemeral port
$ ss -tn state established
Recv-Q Send-Q Local Address:Port Peer Address:Port Process
0 0 127.0.0.1:22 127.0.0.1:35948
0 0 127.0.0.1:35948 127.0.0.1:2205Common ports list: what runs where, and what should face the internet
The table covers the ports that matter most on servers, with two columns most lists leave out: whether the port should ever be reachable from the whole internet, and the published bandwidth amplification factor where the service has been abused for reflection. The factor is reply bytes divided by request bytes. Figures are from CISA alert TA14-017A unless marked; RDP is from NETSCOUT (January 2021) and SLP from Bitsight (April 2023). A dash means none of those sources lists a factor, not that the port is safe.
| Port | Transport | Service | Face the internet? | Amplification |
|---|---|---|---|---|
| 17 | UDP | QOTD (quote of the day) | Never | 140.3 |
| 19 | UDP | CharGEN | Never | 358.8 |
| 20, 21 | TCP | FTP data and control | Avoid; use SFTP instead | - |
| 22 | TCP | SSH, see port 22 | Restrict to known sources, keys only | - |
| 23 | TCP | Telnet | Never (plain-text logins) | - |
| 25 | TCP | SMTP between mail servers | Mail servers only | - |
| 53 | UDP, TCP | DNS, see port 53 | Authoritative servers yes; resolvers only to their own users | 28 to 54, see DNS amplification |
| 67, 68 | UDP | DHCP | No, local network only | - |
| 69 | UDP | TFTP | Never | 60 |
| 80 | TCP | HTTP | Web servers, ideally behind a proxy | - |
| 88 | TCP, UDP | Kerberos | No | - |
| 110 | TCP | POP3 | Prefer 995 | - |
| 111 | TCP, UDP | RPCbind (portmapper) | Never | 7 to 28 |
| 123 | UDP | NTP | Public time servers only; disable monlist | 556.9, see NTP amplification |
| 135 | TCP | Microsoft RPC endpoint mapper | Never | - |
| 137 | UDP | NetBIOS name service | Never | 3.8 |
| 139, 445 | TCP | SMB file sharing | Never | - |
| 143 | TCP | IMAP | Prefer 993 | - |
| 161 | UDP | SNMP | Never | 6.3 (SNMPv2 GetBulk) |
| 179 | TCP | BGP | Configured peers only | - |
| 389 | TCP, UDP | LDAP and CLDAP | Never | 46 to 55 (LDAP), 56 to 70 (CLDAP) |
| 427 | UDP, TCP | SLP (service location) | Never | Over 2,200 (Bitsight) |
| 443 | TCP, UDP | HTTPS, and HTTP/3 over QUIC | Web servers, ideally behind a proxy | - |
| 465, 587 | TCP | Mail submission (TLS, STARTTLS) | Mail servers only | - |
| 500, 4500 | UDP | IPsec IKE and NAT traversal | VPN gateways only | - |
| 514 | UDP | Syslog | No | - |
| 520 | UDP | RIP routing | Never | 131.24 (RIPv1) |
| 636 | TCP | LDAPS | No | - |
| 853 | TCP, UDP | DNS over TLS and over QUIC | Public resolvers only | - |
| 993, 995 | TCP | IMAPS, POP3S | Mail servers only | - |
| 1194 | UDP | OpenVPN | VPN gateways only | - |
| 1433, 1434 | TCP, UDP | Microsoft SQL Server and its browser service | Never | - |
| 1900 | UDP | SSDP (UPnP discovery) | Never | 30.8 |
| 2049 | TCP, UDP | NFS | Never | - |
| 2375 | TCP | Docker API without TLS | Never | - |
| 3306 | TCP | MySQL, MariaDB | Never | - |
| 3389 | TCP, UDP | Remote Desktop (RDP) | Never directly; use a VPN or gateway | 85.9 on UDP (NETSCOUT) |
| 3702 | UDP | WS-Discovery | Never | 10 to 500 |
| 5060 | UDP, TCP | SIP (VoIP signalling) | VoIP servers only, restricted | - |
| 5353 | UDP | Multicast DNS | Never | 2 to 10 |
| 5432 | TCP | PostgreSQL | Never | - |
| 5900 | TCP | VNC | Never | - |
| 6379 | TCP | Redis | Never | - |
| 8080 | TCP | Alternative HTTP, often admin panels | Avoid | - |
| 11211 | TCP, UDP | memcached | Never | 10,000 to 51,000, see memcached amplification |
| 27015 | UDP | Source engine game server query (convention, not IANA) | Game servers only | 5.5 (Steam protocol) |
| 27017 | TCP | MongoDB (IANA lists it for TCP) | Never | - |
06Which ports should be open to the internet?
As few as the server's job requires, each for a reason you can name. A web server needs 80 and 443, a mail server 25 and the submission ports, an authoritative name server 53 over both UDP and TCP. Almost everything else in the table is a management, database, file-sharing or discovery protocol built for a trusted network.
- Start from default deny and open ports one by one, as set out in firewall configuration
- Bind internal services to 127.0.0.1 or a private address rather than 0.0.0.0, so one firewall mistake does not expose them
- Reach management ports (22, 3389, databases) over a VPN or from a short allowlist of source addresses
- Turn off UDP on services that do not need it; memcached has shipped with UDP disabled by default since version 1.5.6
- Re-check with ss after installing packages, because some services start listening as soon as they are installed
- Behind a reverse proxy, let the origin accept 80 and 443 from the proxy only; see how to hide your origin IP
07Why open UDP ports are abused for amplification
A UDP service answers whoever a packet claims to come from, and UDP source addresses can be forged. An attacker sends a small request carrying the victim's address, and the server sends its larger reply to the victim. At memcached's upper figure of about 51,000, one megabit per second of forged requests could in principle summon around 51 gigabits per second of replies, given enough exposed servers.
That is why the table says never for so many UDP services: an exposed amplifier harms someone else first, and your own uplink second, since you pay to send the replies. The mechanics and the wider family are in amplification attacks explained. TCP ports are abused differently, mostly by exhausting connection state, as in a SYN flood.
08What a reverse proxy or firewall changes about open ports
A reverse proxy or CDN carries only the protocols it speaks, normally HTTP and HTTPS. It shields those ports at the origin and absorbs floods aimed at the website, but it does nothing for SSH, mail, game or database ports on the same server, and nothing if attackers know the server's address and target another port directly.
A host firewall decides which ports answer, but it runs on the machine it protects: a flood that fills the uplink arrives before any rule is evaluated. Volumetric protection for non-HTTP ports needs filtering upstream of the link, which is network-level protection rather than a web proxy; Layer 3/4 vs Layer 7 sets out the difference.
| What listens on the port | Does a web reverse proxy help? | What protects it |
|---|---|---|
| Websites and APIs on 80 and 443 | Yes: the proxy terminates and filters the traffic | A proxy or WAF, and an origin that only accepts the proxy |
| Management on 22 or 3389 | No | Allowlist or VPN, key-only login, rate limits |
| Databases and caches (3306, 5432, 6379, 11211) | No | Never public: bind locally and firewall |
| Game and voice servers on UDP | No | Upstream network filtering that understands the protocol |
| Authoritative DNS on 53 | No | Anycast DNS capacity and query filtering |
Questions
Frequently asked questions
Sources
Sources and verification
ss output produced with iproute2 6.1.0 in an isolated network namespace; Linux defaults read from /proc/sys/net/ipv4 on Debian 12; port assignments checked against the IANA service name and port number registry (CSV download); October 2026.
- 01RFC 6335: IANA Procedures for the Management of the Service Name and Transport Protocol Port Number Registry · IETF
- 02Service Name and Transport Protocol Port Number Registry · IANA
- 03RFC 1122: Requirements for Internet Hosts (UDP port unreachable, section 4.1.3.1) · IETF
- 04IP sysctl: ip_local_port_range and ip_unprivileged_port_start · kernel.org
- 05The default dynamic port range for TCP/IP has changed in Windows Vista and Windows Server 2008 · Microsoft Learn
- 06Alert TA14-017A: UDP-Based Amplification Attacks · CISA
- 07Microsoft RDP Reflection/Amplification DDoS Attack Mitigation Recommendations · NETSCOUT ASERT
- 08New high-severity vulnerability (CVE-2023-29552) discovered in the Service Location Protocol · Bitsight
- 09Memcached 1.5.6 release notes (UDP disabled by default) · memcached (GitHub)
Last updated