Networking

Common Server Ports List and How to Check Open Ports

By NileVPS Team · Published · 5 min read

اقرأ المقال بالعربي

An IP address gets a packet to the right server, but a server runs many programs at once: a web server, SSH, perhaps a database and a mail service. Ports are how the operating system decides which program should receive each packet. Understanding ports is essential for configuring firewalls, diagnosing "connection refused" errors, and keeping your VPS from exposing services that should stay private. This guide covers how ports work, the ones you will meet most often, and the commands to inspect them.

What a port is

A port is a 16-bit number, from 0 to 65535, attached to every TCP and UDP packet. Together with the IP address and the protocol, it forms an endpoint. A connection is identified by four values: source IP, source port, destination IP and destination port. That is why thousands of visitors can talk to port 443 on the same server at the same moment: each visitor's side uses a different source port.

TCP and UDP have separate port spaces. TCP port 53 and UDP port 53 are two different things, although DNS happens to use both.

Port ranges

RangeNameNotes
0 to 1023Well-known portsAssigned to standard services; on Linux only root (or a process with the right capability) can bind them
1024 to 49151Registered portsUsed by many applications and databases
49152 to 65535Dynamic or ephemeral portsPicked automatically for the client side of outgoing connections

Linux uses its own ephemeral range, visible with sysctl net.ipv4.ip_local_port_range, which defaults to 32768 to 60999 on most distributions.

Common ports on servers

PortProtocolService
22TCPSSH, SFTP
25TCPSMTP between mail servers
53UDP and TCPDNS
80TCPHTTP
123UDPNTP time synchronization
443TCP, and UDP for HTTP/3HTTPS
465 / 587TCPMail submission from clients (implicit TLS / STARTTLS)
993TCPIMAP over TLS
3306TCPMySQL and MariaDB
5432TCPPostgreSQL
6379TCPRedis
3389TCP and UDPWindows Remote Desktop (RDP)
8080 / 8443TCPAlternative HTTP ports, often app servers or panels

These are conventions, not laws. A service can listen on any port you configure, and attackers scan for services on non-standard ports too, so moving SSH to another port reduces log noise but is not a security control on its own.

Listening, open, closed and filtered

  • Listening: a program has bound to the port and is waiting for connections.
  • Open (from outside): a client can reach the listening program through every firewall in the path.
  • Closed: the host is reachable, but nothing listens; TCP replies with a reset and the client sees "connection refused".
  • Filtered: a firewall drops the packets silently; the client waits and eventually reports a timeout.

The difference between "refused" and "timed out" is one of the quickest clues when debugging.

Checking which ports are listening

On Linux, ss is the modern tool:

# TCP and UDP listening sockets with the owning process
sudo ss -tulpn

# Only a specific port
sudo ss -ltnp 'sport = :443'

# Established connections count per state
ss -s

Look at the local address column. 0.0.0.0:5432 or [::]:5432 means the service accepts connections on every interface, while 127.0.0.1:5432 means only local programs can reach it. For databases, Redis and admin dashboards, loopback or a private network address is usually the right choice.

On Windows Server, use netstat -ano or in PowerShell Get-NetTCPConnection -State Listen.

Testing a port from another machine

# Quick TCP check
nc -zv 203.0.113.10 443

# Check an HTTPS endpoint end to end
curl -I https://example.com

# Scan your own server for open TCP ports (only scan hosts you own)
nmap -Pn 203.0.113.10

PowerShell users can run Test-NetConnection 203.0.113.10 -Port 443.

Opening and closing ports safely

Opening a port has two parts: a program must listen on it, and every firewall in the path must allow it. On Ubuntu with ufw:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose

To close a port, remove its rule (sudo ufw delete allow 8080/tcp) and, better still, stop or rebind the service that does not need to be public. If your provider also offers a cloud firewall, remember that traffic must pass both layers. Allow SSH before enabling a firewall, and keep a browser console available in case you lock yourself out. For a deeper look at rule design, read our guide on how firewalls protect servers.

Port hygiene checklist

  • List listening sockets after every new installation.
  • Bind internal services to 127.0.0.1 or a private interface.
  • Allow only the ports you actually serve, on both IPv4 and IPv6.
  • Restrict SSH and RDP to known source addresses where possible.
  • Re-scan your server from outside after firewall changes.

If you are setting up a new project, you can deploy a VPS with a cloud firewall and a browser console for safe changes.

FAQ

Why does my service work locally but not from the internet?

Usually one of three reasons: the service listens only on 127.0.0.1, the server firewall blocks the port, or a cloud or network firewall in front of the server blocks it. Check ss -tulpn first, then each firewall layer.

Is changing the SSH port a good idea?

It reduces automated login attempts in your logs, which can be pleasant, but it does not replace key-based authentication, disabled password logins and rate limiting. Treat it as noise reduction, not protection.

Can two programs listen on the same port?

Not on the same IP address, protocol and port at the same time, unless they cooperate through options such as SO_REUSEPORT. TCP and UDP are separate, and binding different IP addresses on the same port is allowed. The usual fix for conflicts is a reverse proxy in front of several apps.

Related guides