Enzonic VPS
Cyber Monday: 40% off your first 2 months on VPS plans.Ends in 1d 3hSee deal prices
Guides · 5 min read

Set up a firewall with UFW (IPv4 and IPv6)

Allow SSH and the ports you use, block the rest, on both your shared IPv4 ports and your public IPv6 address.

Your IPv6 address is reachable on every port, so a firewall matters. On the shared IPv4 only your 20 forwarded ports reach the VPS, but the same rules protect them too.

  1. 1Install UFW and set defaults

    Deny incoming, allow outgoing. UFW handles IPv4 and IPv6 together.

    sudo apt install -y ufw
    sudo ufw default deny incoming
    sudo ufw default allow outgoing
  2. 2Allow SSH first

    Port 22 inside the VPS is what both the shared IPv4 SSH port and IPv6 reach.

    sudo ufw allow 22/tcp
  3. 3Allow the services you run

    Web on IPv6 uses 80 and 443. Services on the shared IPv4 use your forwarded port numbers (30021-30039 in this example).

    sudo ufw allow 80,443/tcp
    sudo ufw allow 30021/udp   # e.g. WireGuard
  4. 4Turn it on and check

    UFW asks for confirmation because it can cut SSH if 22 is not allowed.

    sudo ufw enable
    sudo ufw status verbose

Docker publishes ports through its own iptables rules, which bypass UFW. Bind containers to 127.0.0.1 or put them behind a reverse proxy when they should not be public.

Your VPS is a few clicks away

Create it in the VPS panel with your Enzonic account. Refunds within 72 hours of payment.

Deploy a VPS