无法执行:apt-get update

无法执行:apt-get update

我正在尝试执行“apt-get update”,但系统花了很长时间却没有执行任何操作。

Ubuntu-16.04

我可以 ping google.com 附加的 ifconfig 显示 ping 响应

请给我指明正确的方向

所有命令均在 root 用户下运行

--apt-get 更新--

root@ravi-ubundu:/home/ravi# apt-get update
0% [Connecting to gb.archive.ubuntu.com (2001:67c:1560:8001::11)] [Connecting to security.ubuntu.com (2001:67c:1560:8001::11)]

--ifconfig--

root@ravi-ubundu:/home/ravi# ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:8d:de:f3
          inet addr:192.168.0.155  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: 2a02:c7d:9bd9:0:61b1:4d00:dc9:8f14/64 Scope:Global
          inet6 addr: 2a02:c7d:9bd9:0:8f27:1145:2168:8c0d/64 Scope:Global
          inet6 addr: fdb0:6eb3:3be5:0:b5f0:b2d:55b1:6de5/64 Scope:Global
          inet6 addr: fdb0:6eb3:3be5:0:61b1:4d00:dc9:8f14/64 Scope:Global
          inet6 addr: 2a02:c7d:9bd9:0:f0ba:8d3d:befd:94ea/64 Scope:Global
          inet6 addr: fe80::3cdf:4b12:4371:2c3a/64 Scope:Link
          inet6 addr: fdb0:6eb3:3be5:0:5f08:c4d0:8e3d:59a/64 Scope:Global
          inet6 addr: 2a02:c7d:9bd9:0:b5f0:b2d:55b1:6de5/64 Scope:Global
          inet6 addr: fdb0:6eb3:3be5:0:aa18:5aa0:198:5ad0/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1274 errors:0 dropped:0 overruns:0 frame:0
          TX packets:979 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:129718 (129.7 KB)  TX bytes:154341 (154.3 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:302 errors:0 dropped:0 overruns:0 frame:0
          TX packets:302 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:24015 (24.0 KB)  TX bytes:24015 (24.0 KB)

root@ravi-ubundu:/home/ravi# ping google.co.uk
PING google.co.uk (216.58.204.35) 56(84) bytes of data.
64 bytes from lhr25s12-in-f3.1e100.net (216.58.204.35): icmp_seq=1 ttl=57 time=19.3 ms
64 bytes from lhr25s12-in-f3.1e100.net (216.58.204.35): icmp_seq=2 ttl=57 time=18.1 ms
64 bytes from lhr25s12-in-f3.1e100.net (216.58.204.35): icmp_seq=3 ttl=57 time=22.1 ms
^C

答案1

您的系统设置有问题IPv6。您可以使用以下方法禁用它:

$ sudo nano /etc/sysctl.conf

附加此内容:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

运行此命令:

$ sudo sysctl -p

详情请见:https://help.ubuntu.com/community/WebBrowsingSlowIPv6IPv4

如果您将来希望重新启用,IPv6只需从文件中删除附加的行即可/etc/syst.conf

相关内容