在Redhat 7上80端口默认是被过滤掉的,因此我们仅仅能在本机使用localhost访问这个端口,而不能从其他机器上访问这个端口。如果要打开80端口我们需要添加一个iptables规则,对于RHEL7我们可以使用firewall-cmd命令来添加。首先用以下命令添加80端口:
[root@rhel7 ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
然后用以下命令重启firewall服务:
[root@rhel7 ~]# firewall-cmd --reload
接下来检查是否添加成功:
[root@rhel7 ~]# iptables-save | grep 80
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
如果你想屏蔽或者移除80端口,也可以用firewall-cmd命令:
[root@rhel7 ~]# iptables-save | grep 80
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
[root@rhel7 ~]# firewall-cmd --zone=public --remove-port=80/tcp --permanent
success
[root@rhel7 ~]# firewall-cmd --reload
success
[root@rhel7 ~]# iptables-save | grep 80
[root@rhel7 ~]#
最后
以上就是贪玩芝麻最近收集整理的关于redhat mysql运行端口_如何在 Redhat 7 Linux 上使用 firewall-cmd 开启80端口的全部内容,更多相关redhat内容请搜索靠谱客的其他文章。
发表评论 取消回复