檢查防火牆的狀態:
從centos7開始使用systemctl來管理服務和程序,包括了service和chkconfig。
1
2
|
[root@localhost ~]#systemctl list-unit-files|grep firewalld.service --防火牆處於關閉狀態
firewalld.service disabled
|
或者
1
2
3
4
|
[root@localhost ~]#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)
|
關閉防火牆:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
1
2
|
[root@localhost ~]#systemctl stop firewalld.service
[root@localhost ~]#systemctl disable firewalld.service
|
1
2
3
4
5
6
7
8
|
啓動一個服務: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;echo $?
查看已啓動的服務列表:systemctl list-unit-files|grep enabled
|