永久设置ubuntu dns 服务器

DNS on Ubuntu 18.04 and laters

For years it’s been simple to set up DNS on a Linux machine. Just add a couple of entries to /etc/resolv.conf and you’re done.

Use 114 public DNS servers.

nameserver 114.114.114.114
But things change and now it’s not that simple. If you now edit /etc/resolv.conf on Ubuntu you’ll find that the edits are ephemeral. If you restart (or even hibernate) your machine then they’ll be overwritten by default content.

        nameserver 127.0.0.53

search Home
This is pretty simple to fix though.

Install the resolvconf package.

        sudo apt install resolvconf

Edit /etc/resolvconf/resolv.conf.d/head and add the following:

Make edits to /etc/resolvconf/resolv.conf.d/head.

        nameserver 114.114.114.114

Restart the resolvconf service.

        sudo service resolvconf restart

Fix should be permanent.

posted @ 2020-08-20 14:54  逍遥叹wan  阅读(262)  评论(0)    收藏  举报