Networking

Essential Network Protocols for Servers: SSH, HTTP, DNS, SMTP, NTP and More

By NileVPS Team · Published · 5 min read

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

A freshly deployed VPS speaks several network protocols before you install anything: it resolves names, keeps its clock in sync and accepts remote logins. Add a website, an API or email and the list grows. Each protocol has its own port, security model and failure modes, and knowing them is the difference between guessing and fixing. This guide gives a practical tour of the protocols that matter most on servers, with defaults, hardening tips and commands to verify each one.

Quick reference

ProtocolTransport and portPurposeSecure form
SSHTCP 22Remote shell, file transfer, tunnelsEncrypted by design
HTTPTCP 80Web trafficHTTPS on TCP 443 (and HTTP/3 on UDP 443)
DNSUDP and TCP 53Name resolutionDNSSEC for integrity, DoT or DoH for privacy
SMTPTCP 25, 587, 465Sending and relaying emailSTARTTLS or implicit TLS
IMAP / POP3TCP 993 / 995Reading mailboxesTLS versions only
NTPUDP 123Clock synchronizationNTS where supported
RDPTCP and UDP 3389Windows remote desktopTLS with Network Level Authentication
ICMPNo portsDiagnostics, path MTU, errorsRate limiting, not blocking
DHCPUDP 67 / 68Automatic address configurationInternal networks only

If ports themselves are new to you, start with our guide on server ports.

SSH: the administrator's front door

SSH gives you an encrypted shell, file transfer through SFTP and scp, and port forwarding for reaching private services safely. Because it is the main way into a Linux server, it is also the most attacked service on the internet.

Hardening essentials in /etc/ssh/sshd_config:

PasswordAuthentication no
PermitRootLogin prohibit-password
PubkeyAuthentication yes
MaxAuthTries 3

After editing, test the configuration with sudo sshd -t and reload with sudo systemctl reload ssh (the unit is named sshd on RHEL family systems). Keep your current session open until a new login succeeds. A tunnel such as ssh -L 5432:127.0.0.1:5432 user@server lets you reach a database that listens only on loopback, without exposing it.

HTTP and HTTPS: serving the web

HTTP is a request and response protocol: the client sends a method (GET, POST), a path and headers; the server replies with a status code, headers and a body. HTTP/1.1 sends one request at a time per connection, HTTP/2 multiplexes many requests over one TCP connection, and HTTP/3 does the same over QUIC on UDP.

Plain HTTP on port 80 should only redirect to HTTPS. Use a free certificate from an ACME authority, enable HSTS once everything works, and check your setup:

curl -I https://example.com
curl -sI http://example.com | grep -i location
openssl s_client -connect example.com:443 -servername example.com </dev/null | head

DNS: names to addresses

Your server is both a DNS client, resolving names for outgoing connections, and the target of DNS records that point visitors to it. Lookups normally use UDP port 53 and fall back to TCP for large answers and zone transfers. Do not run an open recursive resolver on a public IP; it will be abused for amplification attacks. Our DNS guide explains records and troubleshooting with dig.

SMTP: email delivery

SMTP moves mail between servers on port 25, while mail clients and applications submit messages on port 587 with STARTTLS or 465 with implicit TLS. Deliverability depends heavily on DNS: an SPF record listing allowed senders, DKIM signatures, a DMARC policy, and a reverse DNS (PTR) record that matches the server's hostname. Many cloud providers restrict outgoing port 25 by default to fight spam, so applications on a VPS often send through an authenticated relay on 587 instead.

# Test submission with TLS
openssl s_client -starttls smtp -connect mail.example.com:587 -crlf

NTP: keeping time honest

Accurate time matters more than it seems: TLS certificate checks, log correlation, two-factor codes, scheduled jobs and distributed databases all depend on it. Most distributions ship systemd-timesyncd or chrony.

timedatectl status
chronyc tracking      # if chrony is installed

Look for "System clock synchronized: yes". Servers that only consume time need outgoing UDP 123, not an open inbound port.

RDP: remote desktop for Windows servers

On Windows VPS instances, RDP provides the graphical session. Keep Network Level Authentication enabled, use strong unique passwords or certificate-based access, restrict port 3389 to known source addresses in the firewall, and consider an account lockout policy. Checking the listener from PowerShell:

Get-NetTCPConnection -LocalPort 3389 -State Listen

ICMP: the diagnostic channel

ICMP has no ports but carries essential signals: ping replies, "destination unreachable", "fragmentation needed" for path MTU discovery, and IPv6 neighbor discovery. Rate-limit it instead of blocking it outright, or you will create hard-to-diagnose hangs on large transfers.

A protocol checklist for a new server

  • Allow inbound only what you serve: typically SSH (or RDP), 80 and 443.
  • Disable SSH password logins and use keys.
  • Redirect HTTP to HTTPS and automate certificate renewal.
  • Confirm time sync is active with timedatectl.
  • Never expose open DNS resolvers, SMTP relays or databases to the internet.
  • If you send mail, publish SPF, DKIM and DMARC and set the PTR record.
  • Review listening services with sudo ss -tulpn after every install.

Planning a new server? You can deploy a VPS with a browser console and cloud firewall in a few minutes.

FAQ

Which protocols must be open on a basic web server?

Usually inbound TCP 22 for SSH (ideally restricted to your IP), TCP 80 for redirects and certificate validation, and TCP 443 for HTTPS, plus UDP 443 if you enable HTTP/3. Outbound traffic for DNS, NTP and package updates should be allowed.

Is FTP still a good choice for uploading files?

Plain FTP sends credentials and data unencrypted, so it should be avoided on public networks. SFTP runs over SSH, needs no extra open ports and is supported by common clients such as FileZilla and WinSCP.

Why are my server's emails going to spam?

The most common causes are missing or incorrect SPF, DKIM or DMARC records, no PTR record matching the hostname, an IP with a poor sending reputation, or message content that triggers filters. Fix the DNS records first, then test with a mail checking tool.

Related guides