Ubuntu不同版本修改方法不同
修改Ubuntu 20.04 LTS、Ubuntu 21.10版本的DNS
(1)resolved.conf
首先修改 /etc/systemd/resolved.conf 文件,在其中添加dns信息,例如:
DNS=8.8.8.8 114.114.114.114
然后退出保存。(2)然后以root身份在ubuntu终端中依次执行如下命令:
systemctl restart systemd-resolved systemctl enable systemd-resolved mv /etc/resolv.conf /etc/resolv.conf.bak ln -s /run/systemd/resolve/resolv.conf /etc/
再查看/etc/resolv.conf文件就可以看到新的dns信息已经写入其中了。
Ubuntu 16.04.7 LTS
1.修改配置文件
vi /etc/resolvconf/resolv.conf.d/base
改为如下内容:search localdomain #本机为DNS服务器 nameserver 8.8.8.8 #需要修改为的DNS nameserver 8.8.4.4 #需要修改为的DNS
2.重启服务生效
sudo /etc/init.d/networking restart #使网卡配置生效
sudo /etc/init.d/resolvconf restart #使DNS生效
注:DNS可以只设置一个,也可多个
查询DNS地址 :全国 DNS DNS查询 公共DNS DNS地址 DNS服务器-IP.cn
名称 | DNS 服务器 IP 地址 | |
---|---|---|
114 DNS | 114.114.114.114 | 114.114.115.115 |
阿里AliDNS | 223.5.5.5 | 223.6.6.6 |
百度 BaiduDNS | 180.76.76.76 | |
DNSPod DNS+ | 119.29.29.29 | 119.29.29.29 |
CNNIC SDNS | 1.2.4.8 | 210.2.4.8 |
oneDNS | 117.50.11.11 | 52.80.66.66 |
DNS 派 电信/移动/铁通 | 101.226.4.6 | 218.30.118.6 |
DNS 派 联通 | 123.125.81.6 | 140.207.198.6 |
Google DNS | 8.8.8.8 | 8.8.4.4 |
IBM Quad9 | 9.9.9.9 | |
OpenDNS | 208.67.222.222 | 208.67.220.220 |
V2EX DNS | 199.91.73.222 | 178.79.131.110 |
更多推荐