服务相关:
启动
systemctl start firewalld
service firewalld start
关闭
systemctl stop firewalld
service firewalld stop
查看状态
systemctl status firewalld
开机启用
systemctl enable firewalld
开机禁用
systemctl disable firewalld
防火墙配置
firewall-cmd
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
添加
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 --permanent