昨天在justhost.ru上面购买了一个外国的服务器,为了“减少成本”,我没有配置ipv4,而只有ipv6。然后发现服务器用apt update
无法连接镜像源进行更新。后来查了资料才发现,仅ipv6的服务器是无法解析并连接ipv4的域名或地址的,而大多数镜像源可能还是ipv4的,因此需要修改服务器的dns并配置ipv6镜像源。
1,配置服务器的DNS
这里给出一些常用公共dns:
供应商 | IPv4 | IPv6 |
8.8.8.8 和8.8.4.4 |
2001:4860:4860::8888 和2001:4860:4860::8844 |
|
Cloudflare | 1.1.1.1 和1.0.0.1 |
2606:4700:4700::1111 和2606:4700:4700::1001 |
阿里云 | 223.5.5.5 和223.6.6.6 |
2400:3200::1 和2400:3200:baba::1 |
清华大学 | 101.6.6.6 |
2001:da8::666 |
打开/etc/resolv.conf
这个文件,可以先将其中清空,然后加入下列内容设定dns:
#谷歌 IPv6 DNS nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844 #阿里云 IPv6 DNS nameserver 2400:3200::1 nameserver 2400:3200:baba::1 #Cloudflare IPv6 DNS nameserver 2606:4700:4700::1111 nameserver 2606:4700:4700::1001
任选两个粘贴进去即可,国外的话推荐谷歌和Cloudflare。
2,配置IPv6镜像源
目前找到的就有清华大学镜像源、上海交大镜像源和中科大镜像源支持ipv6,下面贴出Debian 10的镜像配置,其余可以到镜像站官网查看帮助。
网络异常,图片无法展示
|
清华大学:
# 清华大学-Debian 10软件源 deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-proposed-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-proposed-updates main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports main contrib non-free # 清华大学-Debian 10安全更新源 deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
中科大:
# 中科大-Debian 10软件源 deb http://mirrors.ustc.edu.cn/debian buster main contrib non-free deb http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian buster-proposed-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian buster main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian buster-proposed-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free # 中科大-Debian 10安全更新源 deb http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free
上海交大:
# 上海交通大学-Debian 10软件源 deb https://mirror.sjtu.edu.cn/debian buster main contrib non-free deb https://mirror.sjtu.edu.cn/debian buster-updates main contrib non-free deb https://mirror.sjtu.edu.cn/debian buster-proposed-updates main contrib non-free deb https://mirror.sjtu.edu.cn/debian buster-backports main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian buster main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian buster-updates main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian buster-proposed-updates main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian buster-backports main contrib non-free # 上海交通大学-Debian 10安全更新源 deb https://mirror.sjtu.edu.cn/debian-security buster/updates main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian-security buster/updates main contrib non-free
配置完DNS和镜像源,就可以使用apt update
进行更新,然后安装软件了!