查看Linux防火牆狀態


環境:VMware、CentOS8

從centos7開始使用systemctl.firewalld來管理服務和程序,包括了service和chkconfig。

防火牆狀態:systemctl status firewalld.service

Active: inactive (dead)/active(running)

關閉firewall:systemctl stop firewalld.service

重啟:systemctl restart firewalld.service

啟動:systemctl start firewalld.service

禁止firewall開機啟動:systemctl disable firewalld.service

設置開機啟用:systemctl enable firewalld.service

查看服務是否開機啟動:systemctl is-enabled firewalld.service;echo 

查看已啟動的服務列表:systemctl list-unit-files|grep enabled

查看已經開放的端口:firewall-cmd --list-ports

開啟端口:firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含義:

–zone #作用域

–add-port=80/tcp #添加端口,格式為:端口/通訊協議

–permanent #永久生效,沒有此參數重啟后失效


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM