#启动
systemctl start firewalld
#关闭
systemctl stop firewalld
#查看状态
systemctl status firewalld
#开机禁用
systemctl disable firewalld
#开机启用
systemctl enable firewalld
开放端口
firewall-cmd --permanent --zone=public --add-port=8080/tcp
#批量开发端口
firewall-cmd --permanent --zone=public --add-port=8080-8083/tcp
查看端口
firewall-cmd --zone=public --query-port=80/tcp
删除某个端口
firewall-cmd --permanent --zone=public --remove-port=81/tcp
针对某个 IP开放端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="6379" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.233" accept"
删除某个IP
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.51" accept"
针对一个ip段访问
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.0/16" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="9200" accept"
重新载入
firewall-cmd --reload