• About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap
Linux Tutorials for Beginners
Advertisement
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
No Result
View All Result

Home » Rocky Linux » How To Set Up a Firewall Using FirewallD on Rocky Linux 9

How To Set Up a Firewall Using FirewallD on Rocky Linux 9

sammbysamm
October 18, 2023
setup Firewall Using Firewalld Rocky Linux 9

How To Set Up a Firewall Using FirewallD on Rocky Linux 9

Share on FacebookShare on LinkedinShare on Whatsapp

In today’s digital landscape, securing your server is of utmost importance. Basically one of the fundamental components of server security is setting up a firewall. In this article, specifically we’ll walk you through the step-by-step process of how to set up a firewall using firewalld on Rocky Linux 9. On Rocky Linux 9, you can easily achieve this using the “firewalld” utility.

Table of Contents

  • What is firewalld?
    • Step 1: Installation FirewallD on Rocky Linux 9
    • Step 2: Starting FirewallD
    • Step 3: Basic Configuration FirewallD
    • Step 4: Adding Rules
    • Step 5: Enabling SSH Access on Rocky Linux 9
    • Step 6: Checking Rules
    • Step 7: Custom Rules
    • Step 8: Port Forwarding
    • Step 9: Removing Rules
    • Step 10: Managing Services FirewallD
    • Step 11: Troubleshooting FirewallD on Rocky Linux 9
  • Conclusion

What is firewalld?

Before diving into the setup process, let’s briefly discuss what firewalld is and why it’s essential for server security. Firewalld is a dynamic firewall management tool that simplifies the process of configuring and managing firewalls on Linux systems. Generally it provides a user-friendly interface and allows you to define rules and zones to control incoming and outgoing network traffic.

OTHER POSTS

How To Install phpMyAdmin on Rocky Linux 9

How To Secure SSH with Fail2Ban on Rocky Linux 9

How To Install Rocky Linux 9.2 Server with Screenshots

Step 1: Installation FirewallD on Rocky Linux 9

The first step in setting up a firewall with firewalld on Rocky Linux 9 is to ensure that the software is installed on your system. You can do this by running the following command in your terminal:

Bash
$ sudo dnf install firewalld

Step 2: Starting FirewallD

Once firewalld is installed on your Rocky Linux 9, you need to start the service and enable it to start at boot. Execute the following commands:

Bash
$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld
$ sudo systemctl status firewalld
Set Up Firewalld on Rocky Linux 9
Status Firewalld on Rocky Linux 9

Step 3: Basic Configuration FirewallD

Now that firewalld is up and running, let’s configure some basic firewall settings. The primary unit of configuration in firewalld is the “zone.” Zones determine how traffic is filtered and what level of trust is assigned to a network connection. Rocky Linux 9 includes several predefined zones, such as “public,” “home,” and “work.” You can view the available zones by running following command:

Bash
$ sudo firewall-cmd --get-zones

To assign a zone to your network interface (e.g., “public”), use the following command:

Bash
$ sudo firewall-cmd --zone=public --change-interface=eth0

Step 4: Adding Rules

With the zone configured, thus you can now define rules for controlling traffic. Let’s say you want to allow incoming traffic on port 80 (HTTP). You can add the rule like this, use the following command:

Bash
$ sudo firewall-cmd --zone=public --add-service=http --permanent

Don’t forget to reload the firewall to apply the changes, use the following command:

Bash
$ sudo firewall-cmd --reload

Step 5: Enabling SSH Access on Rocky Linux 9

If you’re remotely managing your Rocky Linux 9 server, you’ll want to enable SSH access. To do this, use the following command:

Bash
$ sudo firewall-cmd --zone=public --add-service=ssh --permanent

Afterwards remember to reload the firewall:

Bash
$ sudo firewall-cmd --reload

Step 6: Checking Rules

You can verify the rules that have been added to your firewall by running:

Bash
$ sudo firewall-cmd --list-all

This command will display a list of active zones, services, and ports, allowing you to ensure that your firewall is configured as intended.

Now that we’ve covered the basic setup of firewalld on Rocky Linux 9, let’s explore some advanced configurations to enhance your server’s security.

Step 7: Custom Rules

Firewalld allows you to create custom rules tailored to your specific requirements. For example, if you want to block a specific IP address, you can use the following command:

Bash
$ sudo firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="x.x.x.x" reject'

Replace “x.x.x.x” with the actual IP address you want to block.

Step 8: Port Forwarding

If you’re hosting services on your server, you may need to set up port forwarding. This can be achieved with firewalld as well. To forward incoming traffic from one port to another, use the following syntax:

Bash
$ sudo firewall-cmd --zone=public --add-forward-port=port=8080:proto=tcp:toport=80

This command forwards incoming TCP traffic from port 8080 to port 80.

Step 9: Removing Rules

To remove a rule, use the “–remove” flag followed by the rule specification. For example, to remove the HTTP rule, execute:

Bash
$ sudo firewall-cmd --zone=public --remove-service=http --permanent

Remember to reload the firewall after making changes.

In the final section of this guide, we’ll cover some essential maintenance tasks for your firewalld configuration.

Step 10: Managing Services FirewallD

You can enable or disable services in specific zones with ease. To disable a service, use the following command::

Bash
$ sudo firewall-cmd --zone=public --remove-service=service-name --permanent

And to enable a service:

Bash
$ sudo firewall-cmd --zone=public --add-service=service-name --permanent

Don’t forget to reload the firewall after any changes.

Step 11: Troubleshooting FirewallD on Rocky Linux 9

If you encounter any issues with your firewall configuration, firewalld on Rocky Linux 9 provides helpful logging to diagnose problems. Check the logs with the following command::

Bash
$ sudo journalctl -u firewalld

This command will display firewall-related log entries, aiding you in identifying and resolving issues.

Conclusion

In this comprehensive guide, we’ve walked you through the process of setting up a firewall using firewalld on Rocky Linux 9. By following these steps, you’ve taken a crucial step in securing your server and protecting it from unauthorized access and potential threats. First thing to remember regularly review and update your firewall rules to adapt to changing security needs. With firewalld on Rocky Linux 9, you have a powerful tool at your disposal to maintain a robust and secure server environment. Stay safe, and happy server management!

Also Read Our Other Guides :

  • How To Set Up a Firewall Using FirewallD on CentOS 7
  • How To Set Up a Firewall with UFW on Debian 11
  • How To Set Up a Firewall with UFW on Ubuntu 22.04
  • Initial Setup Debian 11 Server: Secure and Efficient
  • Initial Setup Ubuntu Server 22.04: Secure and Efficient
  • Initial Setup Rocky Linux 9 Server: Secure and Efficient
  • How To Install Rocky Linux 9.2 Server with Screenshots

Finally, now you have learned how to set up a firewall using FirewallD on Rocky Linux 9.

Tags: FirewallFirewallDRocky LinuxSecurityServer Guide

If you got help by our tutorials, please buy me a coffee..!

Buy Me a Coffee

Thank you so much for your support!!

Previous Post

How To Set Up a Firewall Using FirewallD on CentOS 7

Next Post

How To Install PHP 8.2 on Debian 11

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

RECENT POST

Install and Secure phpMyAdmin on Ubuntu 22.04

How To Install and Secure phpMyAdmin on Ubuntu 22.04

by samm
July 22, 2024
0

Are you ready to take control of your MySQL databases on Ubuntu 22.04? In this step-by-step guide, we'll walk you...

Manage Groups on Linux

A Simple Guide: How To Manage Groups on Linux

by samm
November 12, 2023
0

Are you a Linux enthusiast looking to enhance your system administration skills? One fundamental aspect you should master is how...

Install phpMyAdmin on Rocky Linux 9

How To Install phpMyAdmin on Rocky Linux 9

by samm
November 11, 2023
0

If you're navigating the world of Rocky Linux 9 and looking to streamline your MariaDB or MySQL database management, installing...

Logrotate In Linux

How To Manage Log Files Using Logrotate In Linux

by samm
November 10, 2023
0

Log files are an essential part of any Linux system. They provide valuable insights into the system's activities, helping administrators...

Load More

RECOMMENDED.

Install Redis on Debian

How To Install Redis on Debian 11 Server

October 16, 2023
Secure SSH with Fail2Ban

How To Secure SSH with Fail2Ban on Rocky Linux 9

October 29, 2023
sammlinux sammlinux sammlinux

Related Posts

Install phpMyAdmin on Rocky Linux 9
Rocky Linux

How To Install phpMyAdmin on Rocky Linux 9

November 11, 2023
Secure SSH with Fail2Ban
Rocky Linux

How To Secure SSH with Fail2Ban on Rocky Linux 9

October 29, 2023
Install Rocky Linux 9.2 Server
Rocky Linux

How To Install Rocky Linux 9.2 Server with Screenshots

October 20, 2023
Install Nginx on Rocky Linux 9
Rocky Linux

How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

October 16, 2023
Load More
Next Post
Install PHP 8.2 on Debian 11

How To Install PHP 8.2 on Debian 11

  • About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap

© 2023 sammlinux - Learn Today for Lead Tomorrow.

No Result
View All Result
  • Ubuntu
  • Debian
  • Rocky Linux
  • CentOS
  • Linux

© 2023 sammlinux - Learn Today for Lead Tomorrow.