尝试下载文件时,Curl、git 和其他命令挂起

尝试下载文件时,Curl、git 和其他命令挂起

目前在 Ubuntu 18.04.12 上,当我尝试从终端下载某些内容,或推送到 git 或任何类似命令时,它总是无限期地或很长时间地挂在下载上。但是,当我按 Ctrl+C 并重试时,它通常在尝试几次后就会起作用。

我能够进行一些诊断,当 curl 尝试解析服务器的 ipv6 地址而不是 ipv4 时,就会发生挂起。问题是,我没有配置 ipv6 或设置 ipv6 DNS 服务器,所以我真的不明白为什么它会尝试这样做(或者至少为什么它会尝试这么多次而不恢复到 ipv4)。我用 sysctl 禁用了 ipv6,但没有什么区别。

我有点迷茫,因为这似乎没有发生在同一个网络中的其他机器上,但我相信这台机器是唯一一台装有 Ubuntu 18 的机器。

/etc/nsswitch.conf:

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

/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

相关内容