sudo firewall-cmd --zone=public --add-port=443/tcp --permanent # 允许HTTPS流量
sudo firewall-cmd --reload # 重新加载防火墙规则
1. 查看防火墙端口开放列表
firewall-cmd --list-all
2. 指定ip端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="3306" accept"
连续端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="3306-3309" accept"
ip网段
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="3306" accept"
3.重新载入,使配置生效
firewall-cmd --reload
4.删除规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="3306" accept"