修改 /etc/gai.conf

找到下面这一行

#precedence ::ffff:0:0/96  100

当然也可能是

#precedence ::ffff:0:0/96  10

取消注释,修改为:

precedence ::ffff:0:0/96  100

一句话命令:

#鬼知道你这个是结尾10还是100,所以都执行。不过你最好手动去改
sed -i 's/#precedence ::ffff:0:0\/96  100/precedence ::ffff:0:0\/96  100/' /etc/gai.conf
sed -i 's/#precedence ::ffff:0:0\/96  10/precedence ::ffff:0:0\/96  100/' /etc/gai.conf

参考资料: https://u.sb/debian-prefer-ipv4/