How to set up a firewall using FirewallD on OpenSUSE Linux

How to set up a firewall using FirewallD on OpenSUSE Linux

To set up a firewall using FirewallD on OpenSUSE Linux, you will need to install the firewalld package and configure the firewall rules.

First, update the package list and install the firewalld package using the zypper command:

refe‮l:ot r‬autturi.com
sudo zypper refresh
sudo zypper install firewalld

Next, start the firewalld service and enable it to start automatically at boot time:

sudo systemctl start firewalld
sudo systemctl enable firewalld

To view the current firewall status, you can use the firewall-cmd command:

sudo firewall-cmd --state

To allow all incoming traffic and disable the firewall, you can use the following command:

sudo firewall-cmd --set-default-zone=public

To block all incoming traffic and allow only outgoing traffic, you can use the following command:

sudo firewall-cmd --set-default-zone=block

To allow only certain types of traffic, you can use the --add-service option to allow incoming traffic for specific services. For example, to allow incoming SSH traffic (TCP port 22) and outgoing HTTP and HTTPS traffic (TCP ports 80 and 443), you can use the following commands:

sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent

To apply the changes, you will need to reload the firewall configuration:

sudo firewall-cmd --reload

To verify that the firewall is running and the rules are in effect, you can use the firewall-cmd command with the --list-all option:

sudo firewall-cmd --list-all

Keep in mind that this is just a basic example of how to set up a firewall using FirewallD. You will need to customize the firewall rules to meet the specific requirements of your network environment. You should also regularly review and update the firewall rules to ensure that they are secure and effective.

Created Time:2017-10-29 22:08:38  Author:lautturi