Centos – Using Firewall in Centos7

Check the firewall

Use: firewall-cmd

firewall-cmd --state

Use: systemctl

[root@vpn01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Turn off the firewall

The first step: close firewalld

systemctl stop firewalld.service

Step 2: Disable firewalld from booting

systemctl disable firewalld.service

Step 3: Disable selinux

What is SELinux?

  • Temporarily disabled
[root@vpn02 ~]# setenforce 0
  • Permanently shut down: modify the setting SELINUX=disabled in the /etc/selinux/config file
[root@vpn02 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled # set here
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
  • View selinux status
[root@vpn02 ~]# sestatus
SELinux status: disabled