centos7使用systemctl指令來管理系統的單一服務,在centos7中對於firewalld(防火牆)服務的開啟、關閉、狀態查詢也同樣是使用該指令,操作如下:
啟動防火牆: systemctl start firewalld
檢視防火牆狀態: systemctl status firewalld
關閉防火牆: systemctl stop firewalld
開機時啟用防火牆服務:systemctl enable firewalld
開機時禁用防火牆服務:systemctl disable firewalld
查詢防火牆服務是否開機啟動:systemctl is-enabled firewalld
查詢已經啟動的服務列表:systemctl list-unit-files|grep enabled
查詢啟動失敗的服務列表:systemctl –failed
在安裝軟體或列庫時,除了直接開啟和關閉防火牆,也可以通過對埠的操作直接開放連線;新增埠:firewall-cmd –zone=public –add-port=80/tcp –permanent
更新防火牆規則:firewall-cmd –reload
檢視埠狀態:firewall-cmd –zone=public –query-port=80/tcp
刪除開放的埠:firewall-cmd –zone=public –remove-port=80/tcp –permanent
每次都更新防火牆規則,都需要重新更新:firewall-cmd –reload,更新狀態;
此外,在更新完防火牆的設定後,也可以檢視所有開啟的埠:firewall-cmd –zone=public –list-ports
CentOS7 防火牆常用命令
啟動 systemctl start firewalld 檢視狀態 systemctl status firewalld 禁用,禁止開機啟動 systemctl disable firewalld 停止執行 systemctl stop firewalld 重啟防火牆 systemctl resta...
Centos 7 防火牆常用命令
1.關閉防火牆 臨時 僅對本次開機有效,重啟後防火牆會再次啟用 systemctl stop firewalld.service 永久 重啟後防火牆依然關閉 systemctl disable firewalld.service2.開啟防火牆 啟動 systemctl start firewalld...
Centos7防火牆常用命令
1.啟動防火牆 systemctl start firewalld2.關閉防火牆 systemctl stop firewalld3.檢視狀態 systemctl status firewalld4.開機啟用防火牆 systemctl enable firewalld5.開機禁用防火牆 system...