1. 打开 /etc/systemd/resolved.conf,设置变量DNS:
$ sudo gedit /etc/systemd/resolved.conf

2. 单击"save" 按钮,保存设置
3. 输入一下命令,使设置生效
$ systemctl restart systemd-resolved //重启systemd-resolved服务
$ systemctl enable systemd-resolved//使能systemd-resolved服务
$ mv /etc/resolv.conf /etc/resolv.conf.bak//备份修改前的resolv.conf,这一步可以省略。
$ ln -s /run/systemd/resolve/resolv.conf /etc/ //这一步必须执行,否则DNS设置不能有效
注:
1. 亲测可行
2. 和ubuntu14.4的DNS方法是不一样的,如果你的是ubuntu14.4版本,可在百度上搜索,不能使用本文方法去设置。
本文提供了一种在Ubuntu系统中配置DNS的方法,包括编辑resolved.conf文件、重启与使能systemd-resolved服务、备份并更新resolv.conf。适用于除Ubuntu14.4外的版本。

4430

被折叠的 条评论
为什么被折叠?



