Every VPN setup guide eventually says some version of "open the port in your firewall." If you've never managed a server before, that instruction assumes you already know what a firewall is doing and why it needs your permission. Here's the part usually skipped.
What a firewall actually does
A firewall is a set of rules that decides which network connections a server allows and which it silently drops. Every VPS can, in principle, be reached on thousands of different ports — think of a port as one of many separate numbered doorways into the same building — and a firewall's job is deciding which of those doors are open to the outside world and which stay shut.
By default, most fresh VPS images allow very little in: SSH (port 22, so you can actually manage the server) and not much else. Any service you install — a VPN, a web server, anything — needs its own doorway explicitly opened, or connections to it get dropped before they ever reach the software listening on that port.
Why this trips people up
A VPN server can be installed correctly, running correctly, and still be completely unreachable, because nothing opened its port in the firewall. From the outside this looks identical to a broken installation — the connection just times out — which is why "check the firewall" is one of the first troubleshooting steps for a VPN that won't connect at all, alongside DNS issues covered in common self-hosted VPN mistakes.
iptables: the underlying engine
iptables is the low-level tool built into Linux that firewalls are actually made of — it reads and writes the kernel's own packet-filtering rules directly. It's precise and extremely capable, and its syntax reflects that: verbose, easy to get subtly wrong, and unforgiving of a misplaced rule that blocks the very connection you're using to fix it.
Most people don't write iptables rules by hand day to day. It's what's running underneath friendlier tools — and it's also what VPN software itself uses automatically. The PostUp/PostDown lines in a WireGuard config, for instance, are iptables commands the VPN software runs for you to enable traffic forwarding.
ufw: the friendlier front end
ufw (Uncomplicated Firewall) is a simpler layer on top of iptables, built for exactly this kind of everyday task. Instead of iptables' full syntax, opening a port is one line:
sudo ufw allow 51820/udp
That one command is the entire "open the port" step in most WireGuard tutorials, including our own WireGuard-on-Ubuntu guide. A few other commands cover most of what you'll actually need:
sudo ufw status # see what's currently allowed
sudo ufw allow 22/tcp # keep SSH open (do this before enabling ufw!)
sudo ufw allow 51820/udp # open a specific port
sudo ufw enable # turn the firewall on
The one real danger: enabling ufw without first allowing SSH will lock you out of your own server, since the connection you're using to manage it gets blocked along with everything else. Always allow SSH first, on a fresh server, before enabling ufw for the first time.
UDP vs TCP: why it matters which one you open
Ports are opened per protocol, and WireGuard, AmneziaWG, and VLESS don't use the same one — WireGuard and AmneziaWG run over UDP, while VLESS typically runs over TCP. Opening the right port number but the wrong protocol (tcp instead of udp, or vice versa) produces the exact same symptom as not opening it at all: a connection that just times out.
Where Nullsify fits
Setting up a VPN by hand means remembering to open the correct port and protocol yourself, on top of everything else. Nullsify opens the ports each protocol actually needs as part of installing it, so this is one item that doesn't end up on your own troubleshooting list. If you're managing other services on the same VPS, though, this is exactly the tool you'll reach for — ufw for anything you set up yourself, and sudo ufw status as the first thing to check whenever something that should be reachable, isn't.