apt-get 返回暂时无法解析‘archive.ubuntu.com’,而 wget 可以毫无问题地下载文件

apt-get 返回暂时无法解析‘archive.ubuntu.com’,而 wget 可以毫无问题地下载文件

我在 Ubuntu 22.04 中遇到了一个问题,apt-get 无法从存储库下载文件

root@masternode:~# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Ign:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

apt-get clean没有给出任何结果

Ping 工作

wget 下载单个文件也没有问题

该系统是从 ISO 安装的全新 22.04.3 LTS,并未从旧版本更新。

我在这个论坛和其他论坛上没有发现类似的问题。请指教。

root@masternode:~# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 78:e7:d1:62:24:d2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::7ae7:d1ff:fe62:24d2/64 scope link
       valid_lft forever preferred_lft forever
3: enp3s4f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 78:e7:d1:62:24:d3 brd ff:ff:ff:ff:ff:ff
4: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.xx.xx peer 193.25.4.1/32 scope global ppp0
       valid_lft forever preferred_lft forever
5: macvlan1@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether de:90:3c:c8:82:75 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::dc90:3cff:fec8:8275/64 scope link
       valid_lft forever preferred_lft forever
10: macvlan2@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 76:47:91:87:14:87 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::7447:91ff:fe87:1487/64 scope link
       valid_lft forever preferred_lft forever
11: ppp1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.xx.xx peer 193.25.4.1/32 scope global ppp1
       valid_lft forever preferred_lft forever
12: macvlan3@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fe:a7:fa:bb:62:2e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fca7:faff:febb:622e/64 scope link
       valid_lft forever preferred_lft forever
13: ppp2: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.xx.xx peer 193.25.4.1/32 scope global ppp2
       valid_lft forever preferred_lft forever
14: macvlan4@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 62:ea:59:23:1b:20 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::60ea:59ff:fe23:1b20/64 scope link
       valid_lft forever preferred_lft forever
15: ppp3: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.xx.xx peer 193.25.4.1/32 scope global ppp3
       valid_lft forever preferred_lft forever
16: macvlan5@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether f2:31:64:ec:7b:95 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::f031:64ff:feec:7b95/64 scope link
       valid_lft forever preferred_lft forever
17: ppp4: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.xx.xx peer 193.25.4.1/32 scope global ppp4
       valid_lft forever preferred_lft forever
18: macvlan6@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 7a:44:a8:a5:c9:d4 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::7844:a8ff:fea5:c9d4/64 scope link
       valid_lft forever preferred_lft forever
19: ppp5: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp5
       valid_lft forever preferred_lft forever
20: macvlan7@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 56:55:00:e3:63:17 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5455:ff:fee3:6317/64 scope link
       valid_lft forever preferred_lft forever
21: ppp6: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.xx peer 193.25.4.1/32 scope global ppp6
       valid_lft forever preferred_lft forever
22: macvlan8@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ca:dc:5e:ec:39:f6 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c8dc:5eff:feec:39f6/64 scope link
       valid_lft forever preferred_lft forever
23: ppp7: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp7
       valid_lft forever preferred_lft forever
24: macvlan9@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 5e:e9:5e:52:b7:0c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5ce9:5eff:fe52:b70c/64 scope link
       valid_lft forever preferred_lft forever
25: ppp8: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.xx peer 193.25.4.1/32 scope global ppp8
       valid_lft forever preferred_lft forever
26: macvlan10@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ce:60:ff:70:e0:eb brd ff:ff:ff:ff:ff:ff
    inet6 fe80::cc60:ffff:fe70:e0eb/64 scope link
       valid_lft forever preferred_lft forever
27: ppp9: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp9
       valid_lft forever preferred_lft forever
28: macvlan11@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether da:83:7e:2b:e2:2c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d883:7eff:fe2b:e22c/64 scope link
       valid_lft forever preferred_lft forever
29: ppp10: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp10
       valid_lft forever preferred_lft forever
30: macvlan12@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 3e:54:60:b0:02:e5 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3c54:60ff:feb0:2e5/64 scope link
       valid_lft forever preferred_lft forever
31: ppp11: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp11
       valid_lft forever preferred_lft forever
32: macvlan13@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 06:eb:aa:e3:52:03 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::4eb:aaff:fee3:5203/64 scope link
       valid_lft forever preferred_lft forever
33: ppp12: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp12
       valid_lft forever preferred_lft forever
34: macvlan14@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b6:7f:df:69:05:19 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b47f:dfff:fe69:519/64 scope link
       valid_lft forever preferred_lft forever
35: ppp13: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp13
       valid_lft forever preferred_lft forever
36: macvlan15@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d6:1f:ec:17:d0:6f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d41f:ecff:fe17:d06f/64 scope link
       valid_lft forever preferred_lft forever
37: ppp14: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp14
       valid_lft forever preferred_lft forever
38: macvlan16@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 7a:5e:e2:1c:8d:7e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::785e:e2ff:fe1c:8d7e/64 scope link
       valid_lft forever preferred_lft forever
39: ppp15: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp15
       valid_lft forever preferred_lft forever
40: macvlan17@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 22:4e:49:a0:3b:a9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::204e:49ff:fea0:3ba9/64 scope link
       valid_lft forever preferred_lft forever
41: ppp16: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp16
       valid_lft forever preferred_lft forever
42: macvlan18@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 96:2e:62:39:c1:e2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::942e:62ff:fe39:c1e2/64 scope link
       valid_lft forever preferred_lft forever
43: ppp17: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp17
       valid_lft forever preferred_lft forever
44: macvlan19@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1e:8b:39:b0:4f:c8 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::1c8b:39ff:feb0:4fc8/64 scope link
       valid_lft forever preferred_lft forever
45: ppp18: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp18
       valid_lft forever preferred_lft forever
46: macvlan20@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether be:19:b6:68:88:e2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::bc19:b6ff:fe68:88e2/64 scope link
       valid_lft forever preferred_lft forever
47: ppp19: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp19
       valid_lft forever preferred_lft forever
48: macvlan21@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 36:d8:1b:8c:a3:80 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::34d8:1bff:fe8c:a380/64 scope link
       valid_lft forever preferred_lft forever
49: ppp20: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp20
       valid_lft forever preferred_lft forever
50: macvlan22@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b6:43:d8:ff:7e:66 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b443:d8ff:feff:7e66/64 scope link
       valid_lft forever preferred_lft forever
51: ppp21: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp21
       valid_lft forever preferred_lft forever
52: macvlan23@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fe:32:89:20:1d:84 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc32:89ff:fe20:1d84/64 scope link
       valid_lft forever preferred_lft forever
53: ppp22: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp22
       valid_lft forever preferred_lft forever
54: macvlan24@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ee:e4:ad:4e:46:23 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ece4:adff:fe4e:4623/64 scope link
       valid_lft forever preferred_lft forever
55: ppp23: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp23
       valid_lft forever preferred_lft forever
56: macvlan25@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ce:1e:d7:66:a7:d5 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::cc1e:d7ff:fe66:a7d5/64 scope link
       valid_lft forever preferred_lft forever
57: ppp24: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp24
       valid_lft forever preferred_lft forever
58: macvlan26@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether a2:dc:45:13:b1:7e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a0dc:45ff:fe13:b17e/64 scope link
       valid_lft forever preferred_lft forever
59: ppp25: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp25
       valid_lft forever preferred_lft forever
60: macvlan27@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b6:d1:4d:e7:15:d2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b4d1:4dff:fee7:15d2/64 scope link
       valid_lft forever preferred_lft forever
61: ppp26: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp26
       valid_lft forever preferred_lft forever
62: macvlan28@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 5a:b8:5f:85:44:3b brd ff:ff:ff:ff:ff:ff
    inet6 fe80::58b8:5fff:fe85:443b/64 scope link
       valid_lft forever preferred_lft forever
63: ppp27: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp27
       valid_lft forever preferred_lft forever
64: macvlan29@enp3s4f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 6a:31:1d:d9:3f:e4 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::6831:1dff:fed9:3fe4/64 scope link
       valid_lft forever preferred_lft forever
65: ppp28: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 193.25.x.x peer 193.25.4.1/32 scope global ppp28
       valid_lft forever preferred_lft forever

答案1

然后我进行了一次疯狂的拍摄。

控制

ping4 -c4 archive.ubuntu.com

ping6 -c4 archive.ubuntu.com

如果问题出在 ipv4 或 ipv6 上。

强制使用 ipv4

sudo apt-get -o Acquire::ForceIPv4=true update     

强制使用 ipv6

sudo apt-get -o Acquire::ForceIPv6=true update

相关内容