In my Ubuntu 17.04 system why does /etc/resolv.conf fie gets overwritten on restart?

1.1k Views Asked by At

In my Ubuntu 17.04 machine ping google.com did not work. So I opened /etc/resolv.conf file and its content was :

nameserver 192.168.1.1
nameserver 127.0.0.53

I added nameserver 8.8.8.8 to the above file but it gets overwritten on restart of network service.

So as mentioned in the other answers I added nameserver 8.8.8.8 to /etc/resolvconf/resolv.conf.d/base file and restarted network service. Now the nameserver value appears in /etc/resolv.conf file but ping google.com or apt-get update does not work.

Any help regarding this is much appreciated.

1

There are 1 best solutions below

0
shreyas.k On

I solved the above problem by referring this : https://askubuntu.com/a/973025

systemd-resolve --status

returned this

Global
     DNS Servers: 192.168.1.23

I wanted to change this. So after reading above answer, I edited /etc/systemd/resolved.conf

[Resolve]
DNS=192.168.1.1

and restarted the service -

service systemd-resolved restart

Now systemd-resolve --status returned this

Global
     DNS Servers: 192.168.1.1