在 CentOS 7 上打开防火墙端口 [英] Open firewall port on CentOS 7

查看:23
本文介绍了在 CentOS 7 上打开防火墙端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 CentOS 7,我必须确保端口 2888 和 3888 是开放的.

I am using CentOS 7 and I have to ensure that ports 2888 and 3888 are open.

我阅读了 这篇文章 但这不起作用,因为在 CentOS 7 操作系统上有没有 iptables 保存 命令.

I read this article but this did not work because on CentOS 7 OS there is no iptables save command.

有人告诉我上面的 URL 对 CentOS 7 无效.我应该遵循 这个.但是这篇文章我不清楚我需要执行什么命令.

Someone told me that the above URL is not valid for CentOS 7. and I should follow this. But this article is not clear to me on exactly what command I need to execute.

我也找到了

firewall-cmd --zone=public --add-port=2888/tcp 

但这不会在重新启动后继续存在.

but this does not survive reboots.

那么我怎样才能打开端口并使其在重启后仍然有效?

So how can I open the ports and make it survive reboots?

推荐答案

使用此命令查找您的活动区域:

Use this command to find your active zone(s):

firewall-cmd --get-active-zones

它将显示 public、dmz 或其他内容.您应该只申请所需的区域.

It will say either public, dmz, or something else. You should only apply to the zones required.

在公开尝试的情况下:

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

然后记得重新加载防火墙以使更改生效.

Then remember to reload the firewall for changes to take effect.

firewall-cmd --reload

否则,请用 public 代替您的区域,例如,如果您的区域是 dmz:

Otherwise, substitute public for your zone, for example, if your zone is dmz:

firewall-cmd --zone=dmz --add-port=2888/tcp --permanent

这篇关于在 CentOS 7 上打开防火墙端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆