Menu Close

How to get a permanent resolv.conf on Ubuntu?

If you are using a dedicated server or Virtual Private Server (VPS), you might stumbled across a problem where resolv.conf keep resetting even after you changed them. This can cause some problems and one of them is, you cannot reach the outer world.

Some of them keep resetting to a useless dns nameserver that won’t resolve some domains, and very few of them even reset to 127.0.0.1.

Solution

The solution is quite simple. You need to install a package named resolvconf.

$ sudo apt install resolvconf

Then delete whatever you not needed in /etc/resolvconf/resolv.conf.d/head and insert nameservers that you want to use. For example

nameserver 8.8.8.8
nameserver 8.8.4.4

It should look like this

How to get a permanent resolv.conf on Ubuntu? 1

Then restart resolvconf

$ sudo systemctl restart resolvconf

Check your /etc/resolv.conf

$ cat /etc/resolv.conf

and it should display the nameserver you inserted just now.

1 2 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x