Firewalld List Rules Ubuntu

In the realm of network security, firewalls play a pivotal role in protecting your Ubuntu system from unauthorized access and malicious activities. One of the most powerful firewall management tools for Ubuntu is firewalld, which offers a dynamic and flexible way to manage your firewall rules. If you're wondering how to list rules in firewalld on your Ubuntu system, you've come to the right place.

How to list users on Ubuntu
How to list users on Ubuntu

Before we dive into listing rules, let's ensure you have firewalld installed and running on your Ubuntu system. You can install it using the following command:

the linux commands for devops poster
the linux commands for devops poster

Installing and Enabling firewalld

To install firewalld, open your terminal and type:

a table with different types of files and instructions for the file management system, including
a table with different types of files and instructions for the file management system, including

sudo apt update

sudo apt install firewalld

the linux patch checklist is shown in black
the linux patch checklist is shown in black

Once installed, enable and start the firewalld service with:

sudo systemctl enable firewalld

sudo systemctl start firewalld

the linux command commands are displayed in this poster
the linux command commands are displayed in this poster

Checking the Status of firewalld

Before listing rules, ensure firewalld is active and running:

sudo systemctl status firewalld

Linux Commands Cheat Sheet for Beginners 2026
Linux Commands Cheat Sheet for Beginners 2026

If the service is active (running), you're ready to list your rules.

Listing Rules in firewalld

LINUX
LINUX
the linux command commands list is shown in this screenshote, which shows how to use
the linux command commands list is shown in this screenshote, which shows how to use
the router and firewall diagram is shown in red, white, and blue
the router and firewall diagram is shown in red, white, and blue
R-FILES | RDCTD
R-FILES | RDCTD
Linux Terminal Cheat Sheet
Linux Terminal Cheat Sheet
a poster with the words must know linux commands
a poster with the words must know linux commands
Linux Commands Cheat Sheet
Linux Commands Cheat Sheet
Free Up Disk Space in Ubuntu
Free Up Disk Space in Ubuntu
Ubuntu: A Beginner's Guide
Ubuntu: A Beginner's Guide
an orange and white poster with information about the different types of chemicals in each part of it
an orange and white poster with information about the different types of chemicals in each part of it
an image of a computer screen with some type of programming program in the bottom right corner
an image of a computer screen with some type of programming program in the bottom right corner
Linux Cheat Sheet
Linux Cheat Sheet
Linux Basics for Beginners 2026 | Complete Starter Guide
Linux Basics for Beginners 2026 | Complete Starter Guide
🚀 Master Linux Basics
🚀 Master Linux Basics
a black and yellow flyer with linux commands
a black and yellow flyer with linux commands
Linux Commands Cheat Sheet for Beginners
Linux Commands Cheat Sheet for Beginners
the ultimate linux command commands for long - term and processing documents, including text or images
the ultimate linux command commands for long - term and processing documents, including text or images
an image of a computer screen with different colors
an image of a computer screen with different colors
Linux Runlevels and Systemd Targets Explained for Beginners
Linux Runlevels and Systemd Targets Explained for Beginners
an info sheet with different types of information on it
an info sheet with different types of information on it

To list all the rules in firewalld, use the following command:

sudo firewall-cmd --list-all

This command will display a list of all active rules, including zones, interfaces, sources, services, and ports.

Understanding firewalld Zones

firewalld uses zones to group settings for different levels of trust. Understanding zones is crucial for managing your rules effectively.

To list all available zones, use the following command:

sudo firewall-cmd --get-zones

Default Zone

The default zone is the one that applies when no other zone matches. To find out the default zone, use:

sudo firewall-cmd --get-default-zone

Current Zone

To check the current zone for an interface, use:

sudo firewall-cmd --get-zone-of-interface=eth0

Replace 'eth0' with your interface name.

Managing Rules in firewalld

Now that you know how to list rules and understand zones, let's explore how to manage rules in firewalld.

Adding a Rule

To add a rule allowing incoming traffic on a specific port (e.g., 80 for HTTP), use:

sudo firewall-cmd --permanent --zone=public --add-port=80/tcp

The '--permanent' flag ensures the rule persists after a reboot.

Removing a Rule

To remove a rule, use:

sudo firewall-cmd --permanent --zone=public --remove-port=80/tcp

After adding or removing rules, reload the firewall to apply the changes:

sudo firewall-cmd --reload

Regularly reviewing and managing your firewall rules is essential for maintaining a secure Ubuntu system. With firewalld, listing and managing rules is a straightforward process that empowers you to control your system's network security effectively.