CentOS 7 firewalld
Follow the below steps for the default installation of firewalld
service in centos 7.
First: firewalld
is pre-installed in centos 7. If firewalld
is not installed, install it. To verify and install, issue the below commands.
rpm -qa firewalld
# expected output: firewalld-0.6.3-2.el7_7.2.noarch
# if not installed, install it
yum install firewalld
Second: firewalld
mostly runs as a service. Check the service exists on the host.
ll /usr/lib/systemd/system | grep firewalld
# expected output: -rw-r--r-. 1 root root 674 Jan 30 2018 firewalld.service
# OR
ll /etc/systemd/system | grep firewalld
Third: Verify firewalld service is running and enabled.
If the service is running and it's not enabled, every restart will bring it down. Use the below command.
# check the status of the service (running and enabled)
systemctl status firewalld
# if the service is not running, start it
systemctl start firewalld
# if the service has exited, restart it(check for error if any)
systemctl restart firewalld
# if the service is not enabled, enable it
systemctl enable firewalld
first check status of firewalld
status by below command :
sudo systemctl status firewalld
if you get output Active: active
so run the following command :
sudo systemctl enable firewalld
but if you get output Active: inactive (dead)
or Loaded: masked (/dev/null; bad)
follow the below commands :
sudo systemctl unmask --now firewalld
the output should indicate that the symlink has been removed
. then run the below command :
sudo systemctl enable firewalld
after enabling the firewall, start the firewalld
service:
sudo systemctl start firewalld
when the system executes the command, there is no output. Therefore, it is wise to verify whether the firewall has been activated successfully.
check firewall status with:
sudo systemctl status firewalld
if you see the Active: active (running)
message you can now do what you wanted to do.
No comments:
Post a Comment