How to Check Firewall Status in Ubuntu

The Defensive Architecture Vector

Operating an Ubuntu server connected directly to the public internet without an active firewall is mathematically reckless. Automated botnets continuously scan every single IPv4 address, probing for vulnerable open ports (like standard SSH on Port 22 or unconfigured MySQL instances). You must utilize the Uncomplicated Firewall (UFW) to construct an impenetrable cryptographic barrier, strictly defining exactly which data packets are permitted to cross the threshold into your system. Before modifying these rules, you must execute a diagnostic scan to determine the current status of the shield.

How to Check Firewall Status in Ubuntu

UFW is a streamlined, user-friendly frontend designed to manage the highly complex `iptables` kernel firewall. It provides a simple status command that instantly outputs a readable matrix of all active defensive rules.

1. Open your terminal application or connect to the server via SSH.
2. The Interrogation Command:
* Because checking the firewall status involves querying deep kernel networking modules, a standard user account is mathematically barred from accessing this data. You must invoke root privileges.
* Type exactly:

sudo ufw status

* Press Enter and supply your cryptographic password.
3. Analyzing the Telemetry (Status: Inactive):
* If the terminal outputs a single line stating `Status: inactive`, your server is currently operating with zero defensive barriers. Every single port is fully exposed to the public internet.
* Do not blindly activate it yet. If you activate the firewall without explicitly allowing SSH traffic, the firewall will instantly sever your current connection and permanently lock you out of your own server.
4. Analyzing the Telemetry (Status: Active):
* If the firewall is running, the terminal will output `Status: active` followed by a dense matrix of routing rules.
* To: This column dictates the destination port (e.g., `22` for SSH, `80` for HTTP, `443` for HTTPS).
* Action: This column dictates the kernel’s response (e.g., `ALLOW`, `DENY`, or `REJECT`).
* From: This column specifies the origin IP address. If it says `Anywhere`, the port is open to the entire planet. If it lists a specific IP (e.g., `192.168.1.50`), only that exact machine is permitted to connect.
5. The Verbose Interrogation (Advanced Routing):
* If you need to see the exact default policies (e.g., are all incoming connections denied by default?), you must append the verbose flag.
* Type: sudo ufw status verbose
* This outputs the core structural logic of the firewall before listing the individual rules.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.