美文网首页
2019-08-21 firewalld 开启 80 端口

2019-08-21 firewalld 开启 80 端口

作者: 五大RobertWu伍洋 | 来源:发表于2020-06-24 11:14 被阅读0次

firewall-cmd --zone=public --add-port=80/tcp --permanent

出现 success 表明持久化成功,但此时并未添加规则哦!

同时执行如下两条命令才表示既添加规则又永久保存(重启后会自动载入持久化的规则):

## add rule and take effect now
sudo firewall-cmd --add-port 8889/tcp
## persist rule to file only, not add it now
sudo firewall-cmd --add-port 8889/tcp --permanent

命令含义:

--zone #作用域

--add-port=80/tcp # 添加端口,格式为:端口 / 通讯协议

--permanent #永久生效,没有此参数重启后失效

上述操作不需要重启防火墙即可生效哦。

另,如何查看当前防火墙允许的端口列表呢?

### how to list all fire rules and add a tcp port to allow rules
sudo firewall-cmd --list-all

确实需要重启防火墙,则使用如下命令:
systemctl restart firewalld.service

相关文章

网友评论

      本文标题:2019-08-21 firewalld 开启 80 端口

      本文链接:https://www.haomeiwen.com/subject/bqhwsctx.html