centos 7 - 打开防火墙端口 [英] centos 7 - open firewall port

查看:415
本文介绍了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.

我认为上述网址对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

推荐答案

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

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.

在dmz的情况下尝试:

In the case of dmz try:

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

否则,例如,如果您的区域是公共的:

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

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

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

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

firewall-cmd --reload

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

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