查看防火墙状态:
systemctl status firewalld;
打开防火墙:
systemctl start firewalld;
查看所有已开放的临时端口(默认为空):
firewall-cmd --list-ports;
查看所有永久开放的端口(默认为空):
firewall-cmd --list-ports --permanent;
添加临时开放端口:
firewall-cmd --add-port=8086/tcp;
添加永久开放的端口:
firewall-cmd --add-port=8086/tcp --permanent;
关闭临时端口:
firewall-cmd --remove-port=8086/tcp;
关闭永久端口:
firewll-cmd --remove-port=8086/tcp --permanent;
配置结束后需要输入重载命令并重启防火墙以生效配置:
firewall-cmd --reload;
systemctl restart firewalld;