FedoraRHEL Based

How To Install FirewallD on Fedora 40

Install FirewallD on Fedora 40

In this tutorial, we will show you how to install FirewallD on Fedora 40. Fedora 40, the latest release of the popular Linux distribution, comes packed with a plethora of features and improvements that enhance user experience and system performance. As with any modern operating system, security is a top priority, and Fedora 40 is no exception. One of the most effective ways to bolster your system’s security is by utilizing a robust firewall solution. Enter FirewallD, a powerful and user-friendly firewall management tool that comes pre-installed on Fedora 40.

In this comprehensive guide, we’ll walk you through the process of installing, configuring, and managing FirewallD on your Fedora 40 system, ensuring your device remains secure against potential threats.

Prerequisites

Before we dive into the installation process, ensure that you have the following prerequisites in place:

  • A server running one of the following operating systems: Fedora 40.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A stable internet connection to download the necessary packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install FirewallD on Fedora 40

Step 1. Update the System.

Before proceeding with the installation, it’s crucial to ensure your Fedora 40 system is up to date. To do so, open a terminal and run the following command:

sudo dnf clean all
sudo dnf update

This command will fetch and install any available updates for your system, ensuring you have the latest security patches and bug fixes.

Step 2. Installing FirewallD.

As mentioned earlier, FirewallD comes pre-installed on Fedora 40. However, if for some reason it’s not present on your system, you can easily install it using the DNF package manager. Open a terminal and run the following command:

sudo dnf install firewalld

Once the installation is complete, you can verify that FirewallD is installed correctly by running the following command:

firewall-cmd --version

This command will display the current version of FirewallD installed on your system, confirming a successful installation.

With FirewallD installed, the next step is to start the service and enable it to run automatically at system boot. To start FirewallD, use the following command:

sudo systemctl start firewalld

To enable FirewallD to start automatically at boot, run:

sudo systemctl enable firewalld

Your Fedora 40 system now has FirewallD up and running, ready to protect your device from potential security threats.

Step 3. Basic Configuration

FirewallD introduces the concept of zones, which are predefined sets of rules that determine how incoming and outgoing traffic is handled. Understanding and configuring these zones is essential for effectively managing your firewall.

  • Configuring Zones

To assign network interfaces to specific zones, you can use the following command:

sudo firewall-cmd --zone=<zone_name> --change-interface=<interface_name>

Replace <zone_name> with the desired zone and <interface_name> with the network interface you want to assign to that zone.

To set a default zone that will be used for all unassigned interfaces, run:

sudo firewall-cmd --set-default-zone=<zone_name>
  • Adding and Removing Services

Services are predefined rules that allow incoming traffic for specific applications or protocols. To add a service to a zone, use the following command:

sudo firewall-cmd --zone=<zone_name> --add-service=<service_name>

To remove a service from a zone, run:

sudo firewall-cmd --zone=<zone_name> --remove-service=<service_name>
  • Port Management

In addition to services, FirewallD allows you to open or close specific ports. To open a port, use the following command:

sudo firewall-cmd --zone=<zone_name> --add-port=<port_number>/<protocol>

Replace <zone_name> with the desired zone, <port_number> with the port you want to open, and <protocol> with either tcp or udp.

To close a port, run:

sudo firewall-cmd --zone=<zone_name> --remove-port=<port_number>/<protocol>

For more advanced port configurations, you can use rich rules, which allow you to specify additional criteria such as source and destination addresses, port ranges, and more. Consult the FirewallD documentation for a complete guide on using rich rules.

  • Testing FirewallD Configuration

To test your FirewallD configuration, you can use the --list-all option to display the current settings for a specific zone:

sudo firewall-cmd --zone=<zone_name> --list-all

Congratulations! You have successfully installed FirewallD. Thanks for using this tutorial for installing FirewallD on Fedora 40. system. For additional help or useful information, we recommend you check the Fedora website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button