← Networking
Linux · Networking

How to check firewall rules in Linux

Check the active firewall rules with firewall-cmd on RHEL/Oracle Linux, ufw on Ubuntu, and nft as the low-level view.


See what the firewall allows. RHEL / Oracle Linux use firewalld; Ubuntu commonly uses ufw; both sit on top of nftables. Check whichever your system runs.

# firewalld (RHEL / Oracle Linux)
sudo firewall-cmd --state
sudo firewall-cmd --list-all

# ufw (Ubuntu / Debian)
sudo ufw status verbose

# Low-level nftables ruleset
sudo nft list ruleset

# Legacy iptables view
sudo iptables -L -n -v
LinuxfirewalldFirewall