小编lil*_*ily的帖子

为什么centos 7上不在防火墙开放端口的端口可以从外部访问?

我有一个使用 CentOS 7 的远程 vps,相关firewalld信息如下,firewalld正在积极运行。

[root@doer mydir]# firewall-cmd --get-zone-of-interface=eth0
no zone
[root@ doer mydir]# firewall-cmd --list-ports
You're performing an operation over default zone ('public'),
but your connections/interfaces are in zone 'home' (see --get-active-zones)
You most likely need to use --zone=home option.

3306/tcp
Run Code Online (Sandbox Code Playgroud)

我运行一个带有 Spring Boot 程序的 Docker 容器,该程序监听端口 8080,该端口映射到主机的 9182,9182 不在开放端口列表中,但我仍然可以通过http://HOST_MACHINE_IP:9182访问 Web 服务器, 怎么了?


我添加eth0到公共区域

firewall-cmd --permanent --zone=home --add-interface=eth0
Run Code Online (Sandbox Code Playgroud)

现在

[root@ doer mydir]#  firewall-cmd --get-zone-of-interface=eth0
public


[root@ doer mydir]#  firewall-cmd --list-ports
3306/tcp …
Run Code Online (Sandbox Code Playgroud)

networking linux centos firewalld centos7

7
推荐指数
2
解决办法
7615
查看次数

标签 统计

centos ×1

centos7 ×1

firewalld ×1

linux ×1

networking ×1