📢 LordCloud support has moved to Ballastra — Join now →
Docs

Firewall configuration

Set up UFW on Ubuntu/Debian — allow SSH first, open only the ports you need, and check the rules.

1 min read
On this page

A firewall should allow only what you actually use.

Set up UFW#

bash
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH        # or: sudo ufw allow 2222/tcp if you moved SSH
sudo ufw enable

Open ports for your services#

bash
# Web server
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Minecraft Java
sudo ufw allow 25565/tcp

# Minecraft Bedrock / Geyser (NetherNet needs TCP for signaling + UDP for gameplay)
sudo ufw allow 19132/tcp
sudo ufw allow 19132/udp

Check and remove rules#

bash
sudo ufw status numbered
sudo ufw delete 3      # removes rule number 3

Restrict a port to one IP#

For example, allow a database only from your app server:

bash
sudo ufw allow from 203.0.113.10 to any port 3306 proto tcp

Docker warning#

Docker writes its own iptables rules, and published container ports can bypass UFW. Bind containers to localhost (-p 127.0.0.1:8080:80) and put a reverse proxy in front, or use Docker-aware firewall configuration.

Windows VPS#

Use Windows Defender Firewall with Advanced Security → Inbound Rules → New Rule, and only open the ports you need.

Have a question? Chat with us👋