編碼的世界 / 優質文選 / 感情

CentOS7 如何關閉防火牆


2021年7月05日
-   

centos7  默認防火牆是firewalld    所以查看防火牆狀態命令:systemctl status firewalld.service   
CentOS7默認的防火牆不是iptables,而是firewalle.

執行後可以看到綠色字樣標注的“active(running)”,說明防火牆是開啟狀態
使用命令:systemctl stop firewalld.service        關閉運行的防火牆

關閉後,使用命令systemctl status firewalld.service         查看防火牆狀態
可以看到,disavtive(dead)的字樣,說明防火牆已經關閉
前面的方法,一旦重啟操作系統,防火牆就自動開啟了,該怎麼設置才能永久關閉防火牆呢?
輸入命令:systemctl disable firewalld.service,開機禁止防火牆服務器
                  systemctl enable firewalld.service,開機啟動防火牆服務器

 
 
Unit iptables.service could not be found   出現此情況可能是iptables防火牆未安裝。service iptables status(centos6)
#停止firewalld服務
systemctl stop firewalld
#禁用firewalld服務
systemctl mask firewalld
開啟
systemctl unmask firewalld
安裝iptables-services:
yum install iptables-services
設置開機啟動:
systemctl enable iptables
systemctl [stop|start|restart] iptables #or service iptables [stop|start|restart]
service iptables save #or /usr/libexec/iptables/iptables.init save
然後
service iptables status
 
 
 
 
 
 
 
 
 

熱門文章