# How do I set up the firewall on my cloud server?

> Add incoming and outgoing firewall rules to your Phluit cloud server from the portal: protocols, ports, address ranges, and keeping SSH port 22 open.

Source: https://docs.phluit.com/products/managed-vms/cloud-firewall/

The **Firewall** tab on your server's page controls which traffic may reach the server.

## Before you add a rule

A new server has no firewall of its own, so **all ports are open**. The first rule you add creates the firewall, with:

-   **SSH (port 22) open** to everyone,
-   **all outgoing traffic allowed**,
-   your new rule.

From then on, only the incoming traffic you allow gets through.

## Add a rule

1.  Open the **Firewall** tab.
2.  Under **Add a rule**, choose **Incoming** or **Outgoing**.
3.  Choose the protocol: **TCP**, **UDP** or **ICMP** (ping).
4.  Enter the ports: one port (443), a range (8000-8100) or "all". ICMP has no ports.
5.  Enter the addresses, separated by commas: single IP addresses or ranges such as 10.0.0.0/8. Leave it empty to allow **anywhere**. You can add up to 20 addresses per rule.
6.  Click **Add rule**.

The rules are listed under **Incoming rules** and **Outgoing rules**. To delete one, click **Remove** next to it.

## Common rules

| To allow | Direction | Protocol | Ports |
| --- | --- | --- | --- |
| A website (HTTP) | Incoming | TCP | 80 |
| A website (HTTPS) | Incoming | TCP | 443 |
| Ping | Incoming | ICMP | (none) |

## Good to know

-   **Start with an incoming rule.** If your very first rule is an outgoing one, it replaces "all outgoing traffic allowed", and the server can then only reach what that rule allows.
-   **Keep SSH port 22 open to anywhere** if you use the browser console, the root password reset or the SSH key list on the **Access & console** tab. The portal connects to your server on port 22 for those.
-   If "Incoming rules" says "No incoming traffic is allowed", nothing can reach the server, including SSH.
-   The firewall is removed together with the server.
