DNS Error seen after hour of use

Try this:

Make a backup of /etc/resolv.conf and remove any file write protection (if enabled):

sudo cp /etc/resolv.conf /etc/resolv.conf.bak && sudo chattr -i /etc/resolv.conf

Then, run the following command to auto-generate an /etc/resolv.conf file with Google as the DNS servers:

echo -e "nameserver 8.8.8.8\nsearch 8.8.4.4" | sudo tee /etc/resolv.conf

If desired, once you have completed the edits you can write protect the new resolv.conf (optional).

To write protect /etc/resolv.conf issue the following command::

sudo chattr +i /etc/resolv.conf

To remove write protection from /etc/resolv.conf issue the following command::

sudo chattr -i /etc/resolv.conf

To restore /etc/resolv.conf to its original state issue the following command:

sudo chattr -i /etc/resolv.conf; sudo cp /etc/resolv.conf.bak /etc/resolv.conf 

You could alternately test the cloudflare dns servers:

Run the following command to auto-generate an /etc/resolv.conf file with cloudflare as the DNS servers:

echo -e "nameserver 1.1.1.1\nsearch 1.0.0.1" | sudo tee /etc/resolv.conf

Reboot after updating your nameservers.

3 Likes