
How do you configure a firewall in CentOS 7? Securing our networks in today’s digital age is more critical than ever. With the increasing threat of cyber attacks, we must understand the importance of firewalls in protecting our networks.
What is Firewall?
A firewall is a security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. It acts as a barrier between a trusted and untrusted network, such as the Internet.
Configure Firewall in CentOS 7: Step-by-Step Guide
In this article, I will show you how to configure firewall service in CentOS 7 by using a firewalld daemon.
First, it needs to be installed on the package in linux
Step 1: Install epel-release
#yum install epel-release
![]()
Step 2: Download firewalld-daemon
#yum install firewalld -y
#firewall-cmd –zone=public –list-all![]()
Step 3 : Run the below command to enable the firewall service.
#systemctl start firewalld
![]()
To Enable at boot :
#systemctl enable firewalld
![]()
Verfiy Firewall is Enable and Running on your System

Step 4 : Check current default zone
#firewall-cmd –get-default-zone

Step 5 : Check all available zones
#firewall-cmd –get-zones
![]()
Step 6 : Open up incoming http, https and ftpd traffic for public zone
#firewall-cmd –permanent –zone=public –add-service=http
#firewall-cmd –permanent –zone=public –add-service=https
#firewall-cmd –permanent –zone=public –add-service=ftpd

Step 7 : Open up incoming traffic with the help of port number
#firewall-cmd –add-port=80/tcp
#firewall-cmd –add-port=443/tcp

Step 8 : Activate the Apply add-rule
#firewall-cmd –reload
![]()
Step 9 : Check Display All Running Firewall Configuration
#firewall-cmd –zone=public –list-all

Thankyou you! for Visiting
If you find this tutorial helpful, please share it with your friends; for more helpful topics, browse the website www.mainvps.net.

