由于安全限制,我有一个在 Azure 上运行的 Ubuntu 18.04.2 LTS VM,没有公共 IP。我可以使用curl 通过HTTP 下载文件,尽管FTP 不起作用。
这些是我收到的错误:
sudo apt-get update
Err:1 http://mirror.cs.unm.edu/archive bionic InRelease
Connection failed [IP: 64.106.20.76 80]
Err:2 http://mirror.cs.unm.edu/archive bionic-updates InRelease
Connection failed [IP: 64.106.20.76 80]
Err:3 http://mirror.cs.unm.edu/archive bionic-backports InRelease
Connection failed [IP: 64.106.20.76 80]
Err:4 http://mirror.cs.unm.edu/archive bionic-security InRelease
Connection failed [IP: 64.106.20.76 80]
Reading package lists... Done
W: Failed to fetch http://mirror.cs.unm.edu/archive/dists/bionic/InRelease Connection failed [IP: 64.106.20.76 80]
W: Failed to fetch http://mirror.cs.unm.edu/archive/dists/bionic-updates/InRelease Connection failed [IP: 64.106.20.76 80]
W: Failed to fetch http://mirror.cs.unm.edu/archive/dists/bionic-backports/InRelease Connection failed [IP: 64.106.20.76 80]
W: Failed to fetch http://mirror.cs.unm.edu/archive/dists/bionic-security/InRelease Connection failed [IP: 64.106.20.76 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)
我选择了http://mirror.cs.unm.edu,因为根据here它只支持HTTP,理论上应该排除FTP问题。
然而,我可以用curl很好地访问这个镜子:
curl -O http://mirror.cs.unm.edu/archive/dists
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10616 100 10616 0 0 61011 0 --:--:-- --:--:-- --:--:-- 61011
Run Code Online (Sandbox Code Playgroud)
我试了好几面镜子都没有成功。据我所知,没有防火墙、代理或防病毒设置干扰更新。所有传出端口均已打开。还尝试了这个问题的所有建议
编辑:关于 DNS 设置,由于此虚拟机通过 ExpressRoute 连接到 Intranet,因此发生了某种神奇的情况。
/etc/resolv.conf 的前几行内容如下:
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
search reddog.microsoft.com
Run Code Online (Sandbox Code Playgroud)
我该如何进一步调试这个问题?
首先,我要感谢@mchid 添加了很多有价值的信息。
事实证明这是一个防火墙问题,但不受我的控制。
首先我只是用来curl
测试连接。当我尝试curl www.google.com
它工作正常时,我会得到 HTML 并确认它来自谷歌。当我尝试时,curl http://speedtest.ftp.otenet.gr/files/test1Mb.db
它似乎可以工作,即没有错误,并且会在本地创建一个文件。
然而,当我尝试时, wget http://speedtest.ftp.otenet.gr/files/test1Mb.db
我会收到一条ERROR 503: Service Unavailable.
消息。然后我尝试调整 HTTP 标头等,但没有成功。所以我突然意识到,curl 可能不起作用,所以我检查了下载的文件,发现它们的大小都是 11kb,并且包含 HTML。该 HTML 是我们 Intranet 被阻止的 URL 消息。攻击网络端点是可行的,但任何文件下载都被阻止。
因此,就我而言,这都是使用 ExpressRoute将Azure VNet 连接到本地网络以及我们的 IT 团队对此施加的限制的结果。
所以这个故事的寓意是:
归档时间: |
|
查看次数: |
17149 次 |
最近记录: |