firewall-cmd --version #查看版本
firewall-cmd --help #查看帮助
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 #查看是否拒绝
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running
systemctl start firewalld.service #启动firewall
systemctl stop firewalld.service #停止firewall
systemctl restart firewalld.service #重启firewall
systemctl status firewalld #查看默认防火墙状态
systemctl enable firewalld.service #启用开机启动firewall
systemctl disable firewalld.service #禁止开机启动firewall
systemctl is-enabled firewalld.service #查看防火墙服务是否开机启动
firewall-cmd --zone=public --query-port=80/tcp 查看端口是否开放
firewall-cmd --zone=public --remove-port=80/tcp --permanent 删除端口
开启指定端口:firewall-cmd --zone=public --add-port=3306/tcp --permanent
查看端口:firewall-cmd --permanent --query-port=3306/tcp
重启防火墙:firewall-cmd --reload