centos7系統防火牆firewall常用命令
查看防火牆運行狀態
- firewall – cmd – – state
停止防火牆
- systemctl stop firewalld
禁止防火牆開機自啟
- systemctl disable firewalld
更多
- 啟動服務: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
- 查看啟動失敗的服務列表:systemctl – – failed
- 查看版本: firewall – cmd – – version
- 查看幫助: firewall – cmd – – help
- 顯示狀態: firewall – cmd – – state
- 查看所有打開的端口: firewall – cmd – – zone = public – – list – ports
- 更新防火牆規則: firewall – cmd – – reload
- 查看區域信息: firewall – cmd – – get – active – zones
- 查看指定接口所屬區域: firewall – cmd – – get – zone – of – interface = eth0
- 拒絕所有包:firewall – cmd – – panic – on
- 取消拒絕狀態: firewall – cmd – – panic – off
- 查看是否拒絕: firewall – cmd – – query – panic