Hostxpeed
Login Get Started →
Security

How to Set Up a Firewall with UFW

5 min read
218 views
Jun 10, 2026

Install UFW

apt install ufw -y

Allow Essential Ports

ufw allow 22/tcp   # SSH
ufw allow 80/tcp   # HTTP
ufw allow 443/tcp  # HTTPS

For control panels:

ufw allow 8083/tcp  # HestiaCP
ufw allow 8090/tcp  # CyberPanel
ufw allow 2083/tcp  # cPanel

Enable UFW

ufw enable

Check Status

ufw status verbose

Advanced Rules

Allow from specific IP only:

ufw allow from 192.168.1.100 to any port 22

Deny specific IP:

ufw deny from 203.0.113.100

Allow port range:

ufw allow 30000:31000/tcp

Delete Rules

ufw status numbered
ufw delete [number]

Reset UFW

ufw reset

Was this article helpful?