Where the server firewall fits
A firewall is one of the oldest and most reliable security controls, and on a dedicated server you control it completely. That freedom is powerful, but it also means nobody else will notice if a rule is wrong. Protection works in layers. The provider's network filters large floods and attack traffic before it reaches your port; see protecting a dedicated server from DDoS attacks. The firewall on your server decides which connections reach which services. Applications then authenticate users and enforce permissions. Each layer catches what the others miss.
| Layer | Handles | Does not handle |
|---|---|---|
| Provider DDoS protection | Volumetric floods, protocol attacks | Which services you expose |
| Server firewall | Port access, source restrictions, rate limits | Large floods that fill the port |
| Web application firewall | Malicious HTTP requests | Non-web services |
| Application | Authentication, authorisation | Network-level attacks |

Dedicated server firewall principles
- Default deny inbound. Nothing is reachable unless a rule allows it.
- Least exposure. Only public services (usually 80 and 443) are open to everyone.
- Restrict admin access. SSH, RDP, control panels and IPMI only from office IPs or through a VPN.
- Bind internal services privately. Databases, caches and queues listen on localhost or a private network.
- Rate-limit new connections to login services.
- Cover IPv6. A locked-down IPv4 firewall with open IPv6 is a common gap.
- Log and review dropped connections.
- Document every rule and why it exists.
Typical ports for a business server
| Service | Port | Who should reach it |
|---|---|---|
| HTTP / HTTPS | 80 / 443 | Everyone |
| SSH | 22 (or custom) | Admin IPs or VPN only |
| Remote Desktop | 3389 | VPN or gateway only, never public |
| MySQL / PostgreSQL | 3306 / 5432 | Localhost or private network |
| Redis | 6379 | Localhost only |
| Mail (SMTP, submission, IMAP) | 25, 587, 993 | As needed if you host mail |
| VPN (WireGuard) | 51820/udp | Staff devices |
| Control panel | Varies | Admin IPs or VPN |
Example: UFW on Ubuntu
UFW is a simple front end for the Linux firewall. The Ubuntu UFW guide covers all options. A typical web server:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow from 203.0.113.10 to any port 22 proto tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw limit 22/tcp
sudo ufw enable
sudo ufw status verbose
Replace the example IP with your office or VPN address. Make sure IPV6=yes is set in UFW's defaults so the same rules apply to IPv6.
Example: nftables
For more control, nftables (the modern replacement for iptables) lets you write rules directly. The nftables wiki is the reference. A minimal policy accepts established connections, loopback traffic, HTTPS from anywhere and SSH from a trusted range, and drops the rest. Keep rules in a file under version control so changes are reviewed.
Windows Firewall on Windows Server
- Keep Windows Defender Firewall enabled on all profiles.
- Restrict Remote Desktop to a VPN subnet or gateway, never to "Any".
- Remove broad allow rules created by installers you no longer need.
- Use group policy to manage rules consistently on several servers.
Rate limiting and brute-force protection
Firewall rate limits slow down attackers trying many connections. Combine them with Fail2ban, which reads logs and blocks IPs that fail authentication repeatedly. For web applications, also rate-limit login, search and API endpoints at the web server or reverse proxy level; our guide to setting up a reverse proxy shows where those limits live. Tune limits carefully: set them too tight and legitimate users behind a shared office or mobile network IP may be blocked, so start generous, watch the logs and tighten gradually.
Watch out for Docker
Docker manipulates firewall rules directly, and published container ports can bypass UFW rules. Publish ports only on localhost (for example 127.0.0.1:8080:80) and put a reverse proxy in front, or configure Docker's firewall integration deliberately. Test from outside after every change.
Do not forget outbound rules
Most guides focus on inbound traffic, but outbound rules matter too. If an attacker does get in, one of the first things they try is connecting out: downloading tools, sending spam or joining a botnet. Many servers allow all outbound traffic by default, which is convenient but generous. For higher-risk servers, consider allowing outbound connections only to what the server genuinely needs: package repositories, your backup destination, payment and email APIs, DNS and time servers. At minimum, block outbound SMTP on servers that should never send mail directly, which stops a compromised web app from becoming a spam cannon and damaging your IP reputation.
Designing admin access properly
The cleanest pattern for small and mid-size businesses is to put every administrative service behind a VPN. Staff connect to a WireGuard or OpenVPN endpoint on the server, then reach SSH, control panels and databases over private addresses. From the public internet, only the VPN port and your public websites are visible. This removes most brute-force noise, makes access easy to revoke when someone leaves and gives auditors a simple answer about how administrators connect. If a VPN is not practical, allow admin ports only from fixed office IPs, and keep a documented, secure way in through IPMI or iLO for emergencies.
Making firewall changes safely
Firewall mistakes can lock you out or silently expose a service. Make changes in a calm window, keep an existing SSH session open while you test a new rule from a second session, and on Linux consider a timed rollback: apply a rule set with an automatic revert in a few minutes unless you confirm it works. Record every change with the date, the person and the reason, so the rule list never becomes a mystery.
Test from the outside
- From another machine, scan your server's public IPv4 and IPv6 addresses with
nmap. - Compare open ports with your documentation.
- Check that databases and admin panels are not reachable.
- Repeat after every software install or configuration change.
Common firewall mistakes
- Enabling a firewall without first allowing SSH, then losing access.
- Opening database ports to the internet for "temporary" testing.
- Forgetting IPv6 rules.
- Docker exposing container ports past UFW.
- Allowing RDP from anywhere.
- Never reviewing or cleaning up old rules, so nobody remembers why a port is open.
For the complete first-day routine, follow how to secure a dedicated server; for SSH specifics, see SSH security best practices.
Why businesses choose SkyRain Cloud dedicated servers
SkyRain Cloud dedicated servers give your firewall strong backing:
- Indian data centers, Indian latency. Intel Xeon dedicated servers are hosted in Mumbai and Delhi, close to customers across India.
- The whole machine is yours. 100% unshared hardware: no other tenants competing for CPU, memory or disk.
- DDoS protection included on the network, so a flood aimed at your IP does not have to become your problem alone.
- Full control. Root or Administrator access plus iLO/IPMI out-of-band management to reboot, reinstall or mount your own ISO.
- Real support channels. 24/7 support tickets, WhatsApp and a Discord community, plus a public status page.
- Simple billing. Monthly billing in rupees with UPI, net banking and cards.
Frequently Asked Questions
Which firewall should I use on a Linux dedicated server?
Which ports should be open on a web server?
Does a server firewall stop DDoS attacks?
Why does Docker bypass my UFW rules?
What if I lock myself out with a firewall rule?
Should I change the SSH port?
Conclusion
A strong dedicated server firewall is simple in principle: deny by default, open only what must be public, restrict admin access, keep internal services private, cover IPv6 and test from outside. Pair it with provider DDoS protection and application security for layered defence.
Compare SkyRain Cloud's plans below, or see the full specs on our dedicated server page.
SkyRain Cloud Dedicated Server Plans
Unshared Intel Xeon bare-metal servers in Mumbai and Delhi data centers with 1 Gbps connectivity. Every plan includes iLO / IPMI out-of-band management, DDoS protection, Full root / Administrator access, Additional IPv4 addresses available and Billed monthly.
| Plan | Cores / Threads | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| Business 2× Intel Xeon E5-2699 v4 (Mumbai / Delhi) | 44 / 88 (2.2 GHz base, 3.6 GHz turbo) | 128 GB DDR4 ECC | 1 TB NVMe SSD | 1 Gbps | ₹17,999/month | Business websites, stores, databases, ERP and many client sites | Order |
| Enterprise 2× Intel Xeon Platinum 8269CY (Mumbai / Delhi) | 52 / 104 (2.5 GHz base, 3.8 GHz turbo) | 128 GB DDR4 ECC | 1 TB NVMe SSD | 1 Gbps | ₹19,999/month | Virtualization hosts, large databases, SaaS and container platforms | Order |
| Custom | More RAM or storage, a second server for failover, or several servers for a cluster: quoted by the team. | Clusters, failover pairs, unusual specs | Ask | ||||
Prices are monthly in INR as listed on the SkyRain Cloud store (verified 2026-11-23). Live stock and final price are shown at checkout.