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
| Protocol | Transport and port | Purpose | Secure form |
|---|---|---|---|
| SSH | TCP 22 | Remote shell, file transfer, tunnels | Encrypted by design |
| HTTP | TCP 80 | Web traffic | HTTPS on TCP 443 (and HTTP/3 on UDP 443) |
| DNS | UDP and TCP 53 | Name resolution | DNSSEC for integrity, DoT or DoH for privacy |
| SMTP | TCP 25, 587, 465 | Sending and relaying email | STARTTLS or implicit TLS |
| IMAP / POP3 | TCP 993 / 995 | Reading mailboxes | TLS versions only |
| NTP | UDP 123 | Clock synchronization | NTS where supported |
| RDP | TCP and UDP 3389 | Windows remote desktop | TLS with Network Level Authentication |
| ICMP | No ports | Diagnostics, path MTU, errors | Rate limiting, not blocking |
| DHCP | UDP 67 / 68 | Automatic address configuration | Internal 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 3After 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 | headDNS: 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 -crlfNTP: 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 installedLook 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 ListenICMP: 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 -tulpnafter 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.