All guides
Term

Port

A 16-bit numerical identifier in TCP and UDP protocol headers used to direct data to a specific process or service on a networked host.

A port is a 16-bit numerical identifier in TCP and UDP protocol headers used to direct network data to a specific process or service on a host. Ranging from 0 to 65535, this logical endpoint operates at the transport layer and allows a single IP address to run multiple independent applications simultaneously by multiplexing incoming and outgoing traffic.

How it works

When a network packet arrives at a server's network interface, the operating system kernel inspects the destination port number inside the transport layer header. It then matches that number against a table of active sockets to hand the payload off to the exact application listening on that endpoint. For return traffic, the client selects an unused high-numbered port so the server knows where to send the response.

The Internet Assigned Numbers Authority (IANA) divides the 65,536 available ports into three distinct ranges:

Range Category Typical Use
0–1023 Well-Known Ports Core system protocols like HTTP (80), HTTPS (443), SSH (22), and DNS (53). Binding to these on Linux usually requires root privileges or specific capabilities.
1024–49151 Registered Ports User-space applications and databases such as MySQL (3306), PostgreSQL (5432), and monitoring agents like Prometheus Node Exporter (9100).
49152–65535 Dynamic / Private Ports Ephemeral ports assigned temporarily by the operating system for outbound client connections.

Example

On a Linux host, you can inspect active listening sockets and verify which processes own them using the ss utility. For instance, if you are configuring server telemetry as outlined in our Node Exporter Setup: Linux Server Monitoring Guide, you can check whether the metrics endpoint is bound to port 9100:

$ ss -lntp | grep 9100
LISTEN 0 4096 *:9100 *:* users:(("node_exporter",pid=1420,fd=3))

Here, the flags instruct ss to show listening (-l) TCP (-t) sockets with numeric port numbers (-n) and process names (-p). The output confirms that node_exporter is listening on all network interfaces (*) on port 9100.

What matters when choosing a server or hosting

  • Firewall and security group controls: Ensure your provider offers a stateful network firewall outside the virtual machine so you can restrict administrative ports (like SSH on 22) to trusted IP addresses before traffic ever reaches your OS.
  • Default port blocks: Many cloud and VPS providers block outbound traffic on port 25 (SMTP) by default to prevent spam. If your infrastructure sends email directly, verify whether the host lifts this restriction upon request.
  • Private networking support: Internal services such as databases, caches, and metrics exporters should communicate over an isolated private VLAN rather than public interfaces. Check our Node Exporter Setup: Hard-Won Data and Configuration Guide for practical patterns on securing internal service ports.

Common mistakes

  • Binding internal services to 0.0.0.0: Configuring a database or metrics daemon to listen on all interfaces exposes it to the public internet unless a firewall blocks the port. Bind internal tools to 127.0.0.1 or a private interface IP instead.
  • Confusing TCP and UDP ports: Port 53 on TCP and port 53 on UDP are completely separate endpoints. Opening only TCP for a service that relies on UDP (such as DNS queries or WireGuard VPNs) will cause connection timeouts.
  • Port collisions in containers and reverse proxies: Two processes cannot bind to the same IP address, protocol, and port combination simultaneously. Attempting to start a second web server on port 80 results in an Address already in use error.

FAQ

Can two applications share the same port number?

Two processes can use the same port number only if they use different transport protocols (one on TCP and one on UDP) or bind to different local IP addresses on the same machine. Otherwise, the operating system rejects the second bind request.

Does changing an application's default port make it secure?

Moving a service like SSH from port 22 to a high random port reduces automated log noise from opportunistic bots, but it is not a real security boundary. Automated scanners check all 65,535 ports quickly, so you still need strong authentication and firewall rules.

How do I check if a port is reachable from outside the server?

While ss confirms a process is listening locally, external tools like nmap -p 9100 your-server-ip or nc -zv your-server-ip 9100 test whether packets actually pass through your provider's network firewall. You can read more about validating exposed endpoints in our Node Exporter Setup Guide: Hard Data on Metrics and Performance.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.