Linux Firewalld List All Rules

In the realm of Linux, managing network traffic is a critical aspect of system administration. One powerful tool for this purpose is firewalld, a dynamic firewall manager that uses iptables and nftables as its backend. When you need to list all rules configured in firewalld, you might find yourself wondering about the best way to do so. This article will guide you through the process, ensuring you have a comprehensive understanding of the topic.

Home Network Firewall Rules: Minimal Allow/Block List That Still Works
Home Network Firewall Rules: Minimal Allow/Block List That Still Works

Before we dive into listing rules, let's briefly discuss why understanding and managing these rules is essential. Firewalld rules help control incoming and outgoing network traffic based on predefined security rules. They ensure only authorized traffic is allowed, enhancing your system's security. Now, let's explore how to list all rules in firewalld.

a black and yellow flyer with linux commands
a black and yellow flyer with linux commands

Understanding Firewalld Zones and Services

Before listing rules, it's crucial to understand the concept of zones and services in firewalld. Zones are a way to group settings for a set of network interfaces. Services, on the other hand, are predefined firewall rules that allow or block specific ports and protocols. Understanding these concepts will help you interpret the listed rules.

Linux Commands Cheat Sheet for Hackers & Developers (Must Know)🔥🚀
Linux Commands Cheat Sheet for Hackers & Developers (Must Know)🔥🚀

Firewalld uses a zone for each network interface by default. You can create custom zones and services to fit your specific needs. Now, let's proceed to list all rules configured in firewalld.

Listing Rules Using the Firewall-Cmd Command

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

The firewall-cmd command-line tool is the primary interface for managing firewalld. To list all rules, you can use the following command:

firewall-cmd --list-all

This command will display a list of all configured rules, including permanent and active rules. The output will be grouped by zones and services, making it easier to understand the rule set.

Here's an example of what the output might look like:

18 Linux Firewall Software: Protect Your Linux System
18 Linux Firewall Software: Protect Your Linux System

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client ssh
  ports: 22/tcp 80/tcp 443/tcp
  protocols:
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

Listing Rules Using the Firewall-Cmd Command with Specific Options

Sometimes, you might want to list rules with specific details. The firewall-cmd command offers several options to filter the output. Here are a few examples:

  • List permanent rules: To list only the permanent rules, use the --permanent option:
  • List rules for a specific zone: To list rules for a specific zone, use the --zone option followed by the zone name:
  • List rules in a specific format: You can use the --xml or --json options to list rules in XML or JSON format, respectively. This can be useful for scripting or further processing the output.
the linux firewall frontends wheel is shown with icons and symbols in it
the linux firewall frontends wheel is shown with icons and symbols in it

For example, to list permanent rules for the public zone in JSON format, you would use the following command:

firewall-cmd --permanent --zone=public --json

Managing and Modifying Firewalld Rules

the linux commands for devops poster
the linux commands for devops poster
Top 15 Kali Linux Commands Every Ethical Hacker Should Know🚀🎯
Top 15 Kali Linux Commands Every Ethical Hacker Should Know🚀🎯
the top 50 linux commands you must know info for beginners to use in windows
the top 50 linux commands you must know info for beginners to use in windows
the basic linux command commands are displayed in this screenshote screen shot, which shows how to use them
the basic linux command commands are displayed in this screenshote screen shot, which shows how to use them
Linux fundamentals explained simply for beginners (2026 guide) -Day 1–2
Linux fundamentals explained simply for beginners (2026 guide) -Day 1–2
the linux system tools list is shown in blue and red colors, with several icons on it
the linux system tools list is shown in blue and red colors, with several icons on it
the linux must know commands list is shown in this screenshote image, and shows how to use them
the linux must know commands list is shown in this screenshote image, and shows how to use them
Different Linux Distributions Explained (Beginner Guide)🚀
Different Linux Distributions Explained (Beginner Guide)🚀
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 fortgate firewall commands poster
the fortgate firewall commands poster
30 LINUX COMMANDS EVERY DEVELOPER SHOULD KNOW
30 LINUX COMMANDS EVERY DEVELOPER SHOULD KNOW
Linux Server Hardening Checklist (2026) 🔐
Linux Server Hardening Checklist (2026) 🔐
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
the info sheet shows different types of linuxs and other web services, including security tools
the info sheet shows different types of linuxs and other web services, including security tools
the linux command commands are displayed in this poster
the linux command commands are displayed in this poster
a poster with many different types of servers
a poster with many different types of servers
Linux Commands
Linux Commands
the linux basics bash commands list
the linux basics bash commands list
Linux Commands you must know🔥
Linux Commands you must know🔥
Linux Cheat Sheet
Linux Cheat Sheet

Now that you know how to list rules, let's briefly discuss how to manage and modify them. Firewalld provides several commands to add, remove, or modify rules. Here are a few examples:

  • Add a service: To allow a specific service, use the --add-service option followed by the service name:
  • Remove a service: To block a specific service, use the --remove-service option followed by the service name:
  • Add a port: To allow a specific port, use the --add-port option followed by the port number and protocol (e.g., 80/tcp):
  • Remove a port: To block a specific port, use the --remove-port option followed by the port number and protocol:

For example, to add the ssh service to the public zone, you would use the following command:

firewall-cmd --permanent --zone=public --add-service=ssh

After adding or modifying rules, you can reload the firewall to apply the changes:

firewall-cmd --reload

In the dynamic world of Linux system administration, understanding and managing firewalld rules is an essential skill. By mastering the firewall-cmd command and its various options, you can effectively control network traffic and enhance your system's security. Keep exploring and expanding your knowledge to become a proficient Linux administrator.