使用命令的方式配置CentOS7防火墙
##Add
firewall-cmd –permanent –zone=public –add-port=80/tcp
##Remove
firewall-cmd –permanent –zone=public –remove-port=80/tcp
##Reload
firewall-cmd –reload
复制代码
检查是否生效
firewall-cmd –zone=public –query-port=80/tcp
列出所有的开放端口
firewall-cmd –list-all
查看防火墙状态
systemctl status firewalld.service
启动防火墙
systemctl start firewalld.service
关闭防火墙
systemctl stop firewalld.service
重新启动防火墙
systemctl restart firewalld.service
更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-05/131158.htm