加入收藏 | 设为首页 | 会员中心 | 我要投稿 新余站长网 (https://www.0790zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

在linux外部无法访问,centos7修改防火墙配置

发布时间:2021-01-18 16:29:16 所属栏目:Linux 来源:网络整理
导读:centos7外部无法访问网页,linux外部无法访问网页 ?主要原因在于防火墙的存在,导致的端口无法访问。 ?CentOS7使用firewall而不是iptables。所以解决这类问题可以通过添加firewall的端口,使其对我们需要用的端口开放 1.使用命令??firewall-cmd?--state查看防

centos7外部无法访问网页,linux外部无法访问网页

?主要原因在于防火墙的存在,导致的端口无法访问。

?CentOS7使用firewall而不是iptables。所以解决这类问题可以通过添加firewall的端口,使其对我们需要用的端口开放

1.使用命令??firewall-cmd?--state查看防火墙状态。得到结果是running或者not?running
2.在running?状态下,向firewall?添加需要开放的端口
?命令为?firewall-cmd?--permanent?--zone=public?--add-port=80/tcp
3.firewall-cmd?--reload?//加载配置,使得修改有效。
4.firewall-cmd?--permanent?--zone=public?--list-ports?查看开启的端口,出现80/tcp这开启正确

?现在就可以访问了


开启防火墙的命令

systemctl?start?firewalld.service

?关闭防火墙的命令

systemctl?stop?firewalld.service

?开机自动启动

systemctl?enable?firewalld.service

?关闭开机自动启动

systemctl?disable?firewalld.service

?查看防火墙状态

systemctl?status?firewalld

?

firewall-cmd?--zone=public?--remove-port=80/tcp?--permanent
firewall-cmd?--reload
systemctl?restart?firewalld.service


(编辑:新余站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读