Search

Easy Guide: How to Install FirewallD on AlmaLinux 9 - Step by Step

Welcome to our comprehensive guide on installing FirewallD on AlmaLinux 9. In this step-by-step installation guide, we will walk you through the process of setting up FirewallD, a powerful firewall management solution for Linux systems. Whether you're a beginner or an experienced user, this guide will help you install FirewallD and secure your system effectively.

Installing FirewallD on AlmaLinux 9 is a crucial step in protecting your system from unauthorized access and managing network traffic. By following the steps outlined in this guide, you'll gain a clear understanding of how to install FirewallD and unleash its powerful features.

Throughout this installation guide, we will cover various topics, including setting up FirewallD zones, working with FirewallD services, allowing and blocking ports, managing FirewallD through the GUI, and stopping and disabling FirewallD, providing you with a comprehensive overview of FirewallD's capabilities.

Whether you're looking to enhance the security of your system or gain more control over network traffic, this step-by-step FirewallD installation guide will equip you with the necessary knowledge to get started. Let's dive in and begin the installation journey.

Setting Up Firewalld Zones on AlmaLinux 9

Firewalld uses the concept of zones to manage network traffic on AlmaLinux 9. Each zone in Firewalld has predefined rules for different levels of trust within your network, such as public, internal, external, and more. These zones help you control access to and from your system based on specific network configurations.

To manage Firewalld zones on AlmaLinux 9, you can follow these steps:

  1. Viewing Zones and Configurations: You can list all available zones and their configurations using the following command: firewall-cmd --get-zones. This will display a list of zones and their associated target settings.
  2. Changing the Default Zone: By default, the public zone is set as the default. You can change the default zone using the following command: firewall-cmd --set-default-zone=zone_name. Replace zone_name with the desired zone name.
  3. Assigning Interfaces to Zones: To assign a network interface to a specific zone, use the following command: firewall-cmd --zone=zone_name --change-interface=interface_name. Replace zone_name with the desired zone name and interface_name with the name of the network interface you want to assign.

Remember to exercise caution while moving interfaces between zones, as certain services may not be available or enabled in certain zones. It's important to understand the requirements of your network and choose the appropriate zone configurations to ensure the desired level of security and accessibility.

Working with FirewallD Services on AlmaLinux 9

In Firewalld, services play a crucial role in managing network traffic and securing your AlmaLinux 9 system. Services are associated with specific ports and protocols, allowing or blocking access to various applications and resources. To effectively manage services in Firewalld, follow these steps:

  1. List all services: You can start by listing all the services supported by Firewalld. This will provide you with an overview of the available services and their associated ports. Use the command firewall-cmd --get-services to view the complete list.
  2. Add services to zones: Once you have identified the services you want to enable, you can add them to specific zones. Each zone has its own set of rules for allowing or blocking services. To add a service to a zone, use the command firewall-cmd --zone=<zone> --add-service=<service>. Replace <zone> with the desired zone and <service> with the name of the service you want to add.
  3. Remove services from zones: If you no longer require a service to be allowed in a specific zone, you can remove it using the command firewall-cmd --zone=<zone> --remove-service=<service>. This will remove the service from the specified zone, blocking access through that zone.

Allowing and Blocking Services

To allow or block a specific service in Firewalld, you can use the appropriate commands. The --add-service= flag allows you to add a service to the firewall, while the --remove-service= flag removes a service from the list of allowed services. For example, to allow SSH access, use the command firewall-cmd --add-service=ssh. Conversely, to block a service, replace --add-service= with --remove-service=. Remember to reload the firewall after making any changes using the command firewall-cmd --reload for the modifications to take effect.

Note: When allowing or blocking services, ensure you are making changes in the correct zone. Services can be allowed or blocked on a per-zone basis, so it's important to specify the correct zone in the commands.

By effectively managing services in Firewalld, you can control the network traffic flowing into and out of your AlmaLinux 9 system. Whether you need to allow specific services for remote access or block certain services for enhanced security, the flexibility of Firewalld allows you to tailor your firewall rules to your specific requirements.

Allowing and Blocking Ports in Firewalld on AlmaLinux 9

Managing ports in Firewalld is an essential aspect of securing your system on AlmaLinux 9. Whether you need to open or close ports, Firewalld provides a simple and effective way to control access to specific services.

To allow incoming traffic on a specific port, you can use the --add-port= flag followed by the port number and the protocol. For example, to allow port 22 for SSH, you would use the command:

sudo firewall-cmd --add-port=22/tcp

To block a port, you can use the --remove-port= flag followed by the port number and the protocol. For instance, to block port 80 for HTTP, you would execute:

sudo firewall-cmd --remove-port=80/tcp

Opening and Closing Ports on AlmaLinux 9

When opening or closing ports, it's important to consider the implications on network services and security. Carefully evaluate the necessity and potential risks before allowing or blocking any port. Regularly review your firewall rules to ensure they align with your system's requirements.

Remember to reload the firewall configuration after making changes for them to take effect:

sudo firewall-cmd --reload

By effectively managing ports in Firewalld, you can have greater control over the network traffic flowing into and out of your AlmaLinux 9 system, strengthening its security and protecting your valuable data.

Managing Firewalld Through the GUI on AlmaLinux 9

If you prefer a graphical interface for managing Firewalld on your AlmaLinux 9 system, you're in luck. The FirewallD GUI provides an easy and intuitive way to configure your firewall settings. Instead of memorizing complex commands, you can simply point and click to add, remove, or modify firewall rules. This graphical tool is especially helpful for those who are more comfortable with a visual interface.

The FirewallD GUI allows you to manage Firewalld zones, services, and ports with ease. You can assign network interfaces to different zones, allowing you to control the level of trust for each connection. With just a few clicks, you can allow or block specific services, ensuring that your system is protected while still allowing necessary network access. You can also open or close ports, providing granular control over the incoming and outgoing traffic.

Installing the FirewallD GUI is a breeze. Using package managers like DNF, you can quickly install the necessary software. Once installed, you can access the GUI from your system's application menu or launch it from the command line. With its user-friendly interface and comprehensive functionality, the FirewallD GUI is a valuable tool for managing your firewall settings on AlmaLinux 9.

Stopping and Disabling Firewalld on AlmaLinux 9

If you no longer need to use Firewalld on your AlmaLinux 9 system, you have the option to stop and disable the service. Stopping Firewalld will temporarily disable the firewall, giving you the freedom to turn it back on when needed. Disabling Firewalld, on the other hand, ensures that the firewall does not start automatically upon system boot.

To stop Firewalld, you can use the following command:

# systemctl stop firewalld

This command will immediately halt the Firewalld service, stopping the firewall protection on your system. To disable Firewalld, preventing it from starting again automatically, use the following command:

# systemctl disable firewalld

Disabling Firewalld will ensure that the firewall does not activate when you restart your AlmaLinux 9 system. This is useful if you prefer to use an alternative firewall solution or if you no longer require firewall protection for your specific use case.

Uninstalling Firewalld on AlmaLinux 9

If you have decided to completely remove Firewalld from your system, you can do so using package managers like DNF. To uninstall Firewalld, use the following command:

# dnf remove firewalld

This command will remove the Firewalld package from your AlmaLinux 9 system, effectively uninstalling it. Keep in mind that uninstalling Firewalld will leave your system without a firewall solution, so make sure to have an alternative firewall in place if necessary.

Conclusion

Installing and configuring FirewallD on AlmaLinux 9 provides you with a powerful firewall management solution. By understanding the concept of zones, managing services and ports, and utilizing the GUI tool, you can effectively secure your system and control network traffic. Whether you choose to use Firewalld through the command line interface or the graphical tool, it offers a user-friendly interface for effective firewall management.

Throughout this step-by-step guide, you have learned how to install Firewalld on AlmaLinux 9 using package managers like DNF or apt. Additionally, you have explored the concept of zones and how to assign network interfaces to different zones, ensuring the appropriate level of trust for your network.

Managing services and ports in Firewalld allows you to allow or block specific services and control access to your system. You have gained the knowledge to add, remove, and manage services and ports in different zones, reinforcing the security of your AlmaLinux 9 system.

For those who prefer a graphical interface, the FirewallD GUI tool provides a user-friendly way to configure firewall rules. With just a few mouse clicks, you can easily modify zones, services, and ports, making firewall management more accessible to all users.

Sys Admin

Sys Admin

I am a Red Hat Certified Engineer (RHCE) and working as an IT Professional since 2012...