安装:yum install firewalld
启动:service firewalld start检查状态: service firewalld status关闭或禁用防火墙:service firewalld stop/disableyum list | grep firewalld
ps -ef | grep firewalld
查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help显示状态: firewall-cmd --state查看所有打开的端口: firewall-cmd --zone=public --list-ports更新防火墙规则: firewall-cmd --reloadfirewall-cmd --list-ports
firewall-cmd --list-servicesfirewall-cmd --query-service=ssh
firewall-cmd --add-service=ssh
firewall-cmd --remove-service=sshfirewall-cmd --query-port=22/tcp
添加
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)重新载入firewall-cmd --reload查看firewall-cmd --zone= public --query-port=80/tcp删除firewall-cmd --zone= public --remove-port=80/tcp --permanentsudo firewall-cmd --permanent --zone=public --add-service=http 允许http通信
sudo firewall-cmd --permanent --zone=public --add-service=https 允许https通信sudo firewall-cmd --reload 重新加载配置