How to Install Iptables Firewall on Fedora Linux

In this tutorial we are going to learn how to Install and Configure Iptables on Fedora Linux. You can follow this tutorial to install iptables on both Fedora Workstation and Fedora Server.

The firewalld is the default firewall in the Fedora 24 which is the latest release. But if you're more familiar with iptables, then you can easily install and configure Iptables on Fedora Linux.

  1. Disable Firewalld on Fedora.
  2. Install and Configure Fedora Iptables Firewall.
Step One

Disable Firewalld on Fedora Linux

Before installing Iptables, We need to to disable the firewalld, which is the default firewall on Fedora 24. We can disable firewalld using the systemctl command.

sudo systemctl stop firewalld

sudo systemctl disable firewalld

systemctl mask firewalld

Step Two

Install and Configure Fedora Iptables Firewall

Now we need to Install Iptables Service on Fedora 24. To install iptables we use dnf install command.

sudo dnf install iptables-services

After the installation is finished, Install and enable Iptables Service on Fedora using the systemctl command.

systemctl start iptables.service

systemctl enable iptables.service

Iptables Firewall Configuration File

The configuration file for Fedora iptables firewall is /etc/sysconfig/iptables file. You can now add new firewall rules to the /etc/sysconfig/iptables configuration file.

List Firewall Rules

You can list the firewall rules using the iptables -L command.

iptables -L

Disable Fedora Iptables Firewall

You can stop iptables using the systemctl command.

sudo systemctl stop iptables

You will need to disable the iptables, if you do not want to start the firewall when system reboot.

sudo systemctl disable iptables

Restart Fedora Iptables Firewall

You need to restart the Iptables, if you made any change to the /etc/sysconfig/iptables file.

sudo systemctl restart iptables

This will restart the Fedora Iptables Firewall.

So that is how we can Install and configure Iptables on Fedora 24. Also, you can do this on any Previous Fedora release.