Knowledge Base

Browse our knowledge base for free solutions to common problems

Basic Management Of Firewalld On Linux

Created On: 14 September 2022
Written by: Ben

Introduction

This is a quick overview of some very basic firewalld related commands that can be run on Linux. With firewalld there is no need to remove iptables as it should be run along side it. All firewalld will do is provide us a much simpler command structure, ultimately anything applied in firewalld gets placed into iptables.

Installing Firewalld & Enabling Autostart

On more modern distros firewalld can be installed using the following command:

yum install firewalld

If it's already installed just ensure it's started using the commands in the next section.

To ensure it autostart on boot:

systemctl enable firewalld.service

Starting, Stopping & Reloading Firewalld

Starting firewalld:

systemctl start firewalld.service

Stopping firewalld:

systemctl stop firewalld.service

Reloading firewalld:

systemctl reload firewalld.service

Allowing Ports Through Firewalld

Allow a single port:

firewall-cmd --permanent --add-port=80/tcp

Allow a port range:

firewall-cmd --permanent --add-port=60000-61000/tcp

Activate Recently Applied Rules

Recently applied rules can be activated bt reloading the firewalld ruleset with the following command:

firewall-cmd --reload

ICTU LTD is a company registered England and Wales (Company No. 09344913) 15 Queen Square, Leeds, West Yorkshire, England, LS2 8AJ
Copyright © 2024 ICTU LTD, All Rights Reserved.
exit