ubuntu18.04更改dns server

打开 /etc/systemd/resolved.conf,设置变量DNS:

$ sudo gedit  /etc/systemd/resolved.conf

Ubuntu18.4设置永久DNS

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设置不能有效

posted @ 2023-04-08 18:34  冲向云霄1998  阅读(153)  评论(0编辑  收藏  举报