Article 9.1 - UFW (Uncomplicated Firewall) — Recommended for Most Users
Short answerInstall UFW, set default deny incoming, allow SSH/HTTP/HTTPS, enable only after SSH port is allowed. Full walkthrough linked below.
Overview
UFW is the recommended firewall front-end on Ubuntu/Debian VPS. Allow your SSH port before enabling or you may lock yourself out — recover via noVNC.
Quick commands
apt update && apt install ufw -y
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp comment "SSH"
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
ufw status verboseLockout recovery
If SSH stops working after enabling UFW, open noVNC and run ufw allow 22/tcp or disable UFW temporarily while fixing rules.
Full guide with diagrams: How to Configure UFW Firewall on Ubuntu/Debian.
Frequently Asked Questions
Should I use UFW or iptables?
Most users should start with UFW. Advanced custom rulesets may use iptables directly — see Article 9.2.
I locked myself out — help?
Open noVNC from Client Area, fix UFW rules, or see the UFW guide recovery section.
Related Articles
Need More Help?
Search this knowledgebase for related guides. If the issue persists, open a ticket at billing.vpsgrid.net with your service ID, primary IP, and steps already tried. See What Information to Include in a Support Request and Security Responsibilities on Unmanaged VPS for scope and required details.
Was this answer helpful?