linux - 带有firewalld服务的Centos 7关闭80端口

标签 linux firewall centos7

我正在使用 Centos 7,并尝试打开端口 80 和 443。

按照指示 centos 7 - open firewall port , RHEL7: How to get started with Firewalld , How to open http port 80 on Redhat 7 Linux using firewall-cmd和其他一些人,我有以下内容:

[ricardo@m42srv02 ~]$ firewall-cmd --list-all
  public (default, active)
  interfaces: enp0s3
  sources: 0.0.0.0/0
  services: dhcpv6-client http https ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

[ricardo@m42srv02 ~]$

即使我添加端口 80/tcp 和 443/tcp 而不是添加服务,结果也是一样的,来自其他机器:

[root@m42srv01 ~]# nmap -T4 -sV -p 1-444 192.168.1.12

Starting Nmap 5.51 ( http://nmap.org ) at 2015-06-04 04:33 CEST
Nmap scan report for 192.168.1.12
Host is up (0.017s latency).
Not shown: 441 filtered ports
PORT    STATE  SERVICE VERSION
22/tcp  open   ssh     OpenSSH 6.6.1 (protocol 2.0)
80/tcp  closed http
443/tcp closed https
MAC Address: 08:00:27:C1:8D:25 (Cadmus Computer Systems)

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 4.28 seconds
[root@m42srv01 ~]#

我尝试添加服务和端口,使用 --permanent 选项,有源和无源,每次更改后总是重新加载防火墙,有时甚至重新启动 firewalld 服务,但这些端口总是关闭的。

Iptables 已禁用。

最佳答案

尝试:firewall-cmd --zone=public --add-port=80/tcp --permanent

在 CentOS Linux 发行版 7.1.1503(核心版)上为我工作

关于linux - 带有firewalld服务的Centos 7关闭80端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30663698/

相关文章:

javascript - @angular/cli 4 不会安装在 debian 上

Linux查找同名文件复制到目标文件夹不覆盖

python - 当在 python 中使用任何 Web 请求库时,响应在我的公司 PC 上超时,但在我的个人 PC 上却没有?

centos - CentOS 默认 confiteor repos 和 vault (online repos) 之间有什么关系

c++ - 如何在 cout 上使用 isatty(),或者我可以假设 cout == 文件描述符 1?

java - 当 JMX 客户端连接时,启用 JMX 的 Java 应用程序似乎打开了一个随机的高阶端口

security - 从哪里开始网络安全

Linux Centos 7,如何安装siunix LaTeX包?

java - Install4j:在 CentOS 7 服务器中执行安装程序无法启动并出现异常

linux - 如何使用命令行删除文件夹中特定文件类型的所有文件