通过 nmap 连接到本地主机时端口显示为打开,但连接到 IP 时端口被过滤

通过 nmap 连接到本地主机时端口显示为打开,但连接到 IP 时端口被过滤

我的 22.04.4 Ubuntu 服务器安装在 Proxmox VE 上。然后我在其上安装了 Discourse 论坛(它使用 Docker)。现在,成功安装后,从网络检查时 Docker 的 443/80 端口显示为已关闭。

运行 nmap localhost 时会看到以下内容:

root@ubuntu-discourse:~# nmap localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2024-04-19 08:08 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000070s latency).
Not shown: 997 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
443/tcp open  https

但是,当对盒子的 IP 地址或主机名执行相同操作时,我看到的是:

root@ubuntu-discourse:~# nmap 192.168.131.211
Starting Nmap 7.80 ( https://nmap.org ) at 2024-04-19 08:10 UTC
Nmap scan report for ubuntu-discourse (192.168.131.211)
Host is up (0.0000090s latency).
Not shown: 997 closed ports
PORT    STATE    SERVICE
22/tcp  open     ssh
80/tcp  filtered http
443/tcp filtered https

我从网络上看到这样的情况:

PS C:\Users\mwojt> nmap 192.168.131.211
Starting Nmap 7.92 ( https://nmap.org ) at 2024-04-19 10:46 îrodkowoeuropejski czas letni
Nmap scan report for 192.168.131.211
Host is up (0.00041s latency).
Not shown: 997 filtered tcp ports (no-response)
PORT    STATE  SERVICE
22/tcp  open   ssh
80/tcp  closed http
443/tcp closed https

以下是 Docker 的端口状态

root@ubuntu-discourse:~# docker port 6922c7802903
80/tcp -> 0.0.0.0:80
80/tcp -> [::]:80
443/tcp -> 0.0.0.0:443
443/tcp -> [::]:443

我还启用了防火墙,因为如果不启用它,端口 22 仅在网络上可见:

root@ubuntu-discourse:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
22                         ALLOW       Anywhere
80 (v6)                    ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)

我不是 Linux/Docker 专家,因此我希望您能就从哪里开始进行故障排除提出建议。

在此先感谢您的帮助!

相关内容