启动防火墙:systemctl start firewalld.service
关闭防火墙:systemctl stop firewalld.service
重启防火墙:systemctl restart firewalld.service
显示防火墙的状态:systemctl status firewalld.service
在开机时启用防火墙:systemctl enable firewalld.service
在开机时禁用防火墙:systemctl disable firewalld.service
查看防火墙是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
其它服务的命令同理~
$ 查看RHEL版本
[root@simulator ~]# cat /proc/version
Linux version 3.10.0-957.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Oct 4 20:48:51 UTC 2018
[root@simulator ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 7.6 (Maipo)
Release: 7.6
Codename: Maipo
[root@simulator ~]#
[root@simulator ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
[root@simulator ~]#
$ 查看防火墙状态,注意到 “Active: inactive (dead)”,所以防火墙是关闭的
[root@simulator bin]# 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)
Nov 12 09:24:40 simulator systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 12 09:24:40 simulator systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 12 11:39:44 simulator systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 12 11:39:45 simulator systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@simulator bin]#