查看防火墙状态
systemctl status firewalld
开放80端口
firewall-cmd --permanent --zone=public --add-port=80/tcp
查看防火墙当前开放的端口
firewall-cmd --zone=public --list-ports
查看防火墙规则配置
firewall-cmd --list-all
重启,关闭,开启防火墙
systemctl restart firewalld.service
systemctl stop firewalld.service
systemctl start firewalld.service
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="129.0.0.0" accept'
禁ping方式
firewall-cmd --zone=public --add-rich-rule='rule protocol value=icmp drop'
解除禁ping
firewall-cmd --reload
查看规则状态
firewall-cmd --state
开放端口
firewall-cmd --add-port=端口/tcp --permanent
开放网段
firewall-cmd --permanent --add-source=192.168.0.0/22
移除规则
firewall-cmd --permanent --remove-source=192.168.0.0/22
开放服务
firewall-cmd --permanent --add-service=http
移除服务
firewall-cmd --permanent --remove-service=http
删除规则
firewall-cmd --remove-port=12222/tcp --permanent
开放10.11访问
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.10.11/32" accept"
开放10.11访问端口22
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.10.11" port port=22 protocol=t