Back to blog

VPN on AlmaLinux, Rocky or CentOS: Firewalld and SELinux

November 8, 2026 2 min read

Nearly every VPN tutorial is written for Ubuntu or Debian. If your VPS runs AlmaLinux, Rocky Linux, CentOS Stream or RHEL, the same commands fail in confusing ways. The VPN works fine on these systems, but four things are different.

1. The firewall is firewalld, not ufw

This is the biggest trap. A tutorial that says sudo ufw allow 51820/udp fails with "command not found", and skipping it leaves the port closed. Check what you have:

sudo firewall-cmd --state

If it says running, open the VPN's port there. For WireGuard or AmneziaWG:

sudo firewall-cmd --permanent --add-port=51820/udp
sudo firewall-cmd --reload

For VLESS:

sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload

Without --permanent the rule vanishes on the next reload or reboot. See what's open with sudo firewall-cmd --list-all. A hand-built WireGuard server also needs NAT so clients can reach the internet, which firewalld calls masquerading:

sudo firewall-cmd --permanent --add-masquerade
sudo firewall-cmd --reload

2. Packages come from dnf

apt doesn't exist. Use dnf (or yum, which points to it):

sudo dnf install -y tcpdump

Some tools live in the extra repository: sudo dnf install -y epel-release enables it.

3. The iptables command may be missing

Minimal images often leave out the iptables command. WireGuard and AmneziaWG servers use it for the NAT rules that pass traffic to the internet, and without it "connected but no internet" is the result. Install it:

sudo dnf install -y iptables

4. SELinux is on

SELinux is a security layer these systems enforce by default. Check it:

getenforce

Enforcing means it's active. It rarely blocks a VPN that runs as a normal service, but if something fails without a clear error, check for denials:

sudo ausearch -m avc -ts recent

Don't switch SELinux off to make a problem go away. If a denial names your VPN program, fix that specific rule. Turning it off removes the protection for the whole server.

Which versions work

Nullsify supports AlmaLinux, Rocky Linux, CentOS Stream, RHEL, Oracle Linux and Fedora, as well as Ubuntu, Debian and Alpine, on 64-bit x86 and ARM servers. During setup it opens the VPN's ports in whichever firewall it finds (ufw, firewalld or iptables) and installs iptables when the system lacks it, so these differences are handled for you.

The host's own firewall is separate, and Nullsify can't change it. If a connection fails after setup, check the provider firewall too.

When something still fails

For everything beginning-to-end, how to make your own VPN works on any supported system.

Ready to run your own VPN?

Bring your own VPS and have VLESS, AmneziaWG, or WireGuard running in minutes — no manual setup required.