centOS命令

Centos7 开放防火墙端口命令

>>>关闭防火墙

systemctl stop firewalld.service             #停止firewall
systemctl disable firewalld.service        #禁止firewall开机启动

>>>>查看开启的所有端口

firewall-cmd --list-ports

>>>开启端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

>>>重启防火墙

firewall-cmd --reload

>>>查看防火墙状态

firewall-cmd --state

更多命令,使用 firewall-cmd --help 查看帮助文件

保存退出后
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章