对指定ip开放指定端口:
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="xxx.xxx.xxx.xxx" port port="xxx" protocol="tcp" accept"
对指定ip关闭指定端口:
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="xxx.xxx.xxx.xxx" port protocol="tcp" port="xxx" accept"
重启后生效:
systemctl restart firewalld.service
列出全部生效的防火墙配置:
firewall-cmd --list-all
开放指定端口:
firewall-cmd --zone=public --add-port=8848/tcp --permanent
关闭指定端口:
firewall-cmd --zone=public --remove-port=8848/tcp --permanent