ubuntu18.04更改dns server
打开 /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设置不能有效