A cloud firewall is a set of inbound rules that you write once in the console and attach to any number of servers. Inbound traffic that matches no rule is dropped. Outbound traffic is always allowed. A server without a firewall has every port open, so attach one to every server that faces the internet.
Create a firewall
- Click Firewalls in the sidebar, under Networking.
- Click Create firewall (on an empty page, Create your first firewall).
- Type a Name, for example
web-servers. - Under Start from, pick a preset:
- SSH only: TCP 22 and ping.
- Web server: TCP 22, 80 and 443, plus ping.
- Windows: TCP 3389 (Remote Desktop) and ping.
- Click Create. The firewall's page opens with the preset rules, ready to edit.
Write the rules
Each row of the Rules table is one rule:
| Column | What to enter |
|---|---|
| Protocol | TCP, UDP or ICMP (ping) |
| Port or range | One port (443) or one range (8000-8100), from 1 to 65535. Ignored for ICMP. |
| Sources | IP addresses or CIDR ranges, comma-separated, IPv4 or IPv6. Empty, or any, means anywhere. |
| Note | A reminder of what the rule is for, up to 60 characters |
- Fill one of the empty rows at the bottom of the table. The page always shows three; to get more, save and three new ones appear.
- To delete a rule, choose the dash at the top of its Protocol menu instead of a protocol.
- You can rename the firewall in the field at the top of the card.
- Click Save and apply. The console answers "Rules saved and sent to the servers that use this firewall."
If any row is not valid, nothing is saved. The console starts its message with "Nothing was saved." and names up to three rows at fault, counted from the top of the table, for example "Rule 4: ports go from 1 to 65535, lowest first." The table then shows the rules as they were before, so make your change again with the fix.
The rules the console accepts:
- One port or one range per row, between 1 and 65535, lowest port first (
8100-8000is refused). A list such as80,443is not valid: write two rows. - Sources must be addresses or ranges, such as
198.51.100.24,203.0.113.0/24or2001:db8::/32. Hostnames are not accepted, and one invalid entry makes the whole row invalid. - Up to 50 rules per firewall: past that, the save is refused with "A firewall holds up to 50 rules."
An example for a web server managed from one office address:
| Protocol | Port or range | Sources | Note |
|---|---|---|---|
| TCP | 22 | 198.51.100.24 | SSH from the office |
| TCP | 80 | HTTP | |
| TCP | 443 | HTTPS | |
| ICMP (ping) | Ping |
Attach it to servers
- Open the server and go to its Networking tab.
- In the Firewall card, choose the firewall in Firewall applied to this server. Choose None: all ports open to remove it.
- Click Apply. The console answers "Firewall assignment saved." and an Apply firewall action appears in the server's Activity tab.
A server uses one firewall at a time. You can also pick one in the Firewall field of the Access step when you deploy, or send its id in the firewall field of an API deploy: its rules are then applied when the server is built. The id is the last part of the firewall page's address, starting with fw_. The firewall page lists its Servers using it, each with an Open button.
Delete a firewall
At the bottom of the firewall page, in the Delete firewall card, click Delete and confirm. Servers that used it go back to having all ports open.
Tips and troubleshooting
- Keep a rule for SSH (22) or RDP (3389), as the console reminds you, and limit its Sources to your own address when it is fixed.
- Locked out? The console still works from the browser: fix the rules and save, or choose None: all ports open on the server and click Apply. If the server itself does not answer, request Console access (VNC) in the Access tab, as described in Regain access with the recovery tools.
- A port must be open twice: in the cloud firewall and in any firewall inside the server (ufw, firewalld, Windows Defender Firewall).
- Test a port from another machine with
nc -vz 203.0.113.10 443. - To send the rules to a server again, click Apply on its Networking tab.
- Each one-click app page lists the ports the app needs under Ports.
- For floods and attacks, see How DDoS filtering works.