firewall-cmd 放行与关闭放行 某端口

新增端口规则

firewall-cmd –zone=public –add-port=9090/tcp –permanent

firewall-cmd –reload

1. 移除端口规则(永久生效)

sudo firewall-cmd –zone=public –remove-port=9090/tcp –permanent

2. 重新加载防火墙

sudo firewall-cmd –reload

3. 验证是否成功

sudo firewall-cmd –zone=public –list-ports