在CentOS 7上打开防火墙端口 [英] Open firewall port on 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 OS上有否iptables save
命令.
I read this article but this did not work because on CentOS 7 OS there is no iptables save
command.
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屋!