Losing DNS Name Resolution

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Askey307

Losing DNS Name Resolution

Post by Askey307 »

Good Morning

Since latest upgrade my system keeps losing DNS resolution setting and revert to 127.0.0.2 every single time this happens on all networks both LAN and WLAN. The network aint a problem at all because it works with everything else. You can ping google but you cannot get internet. After every reboot I have to apply the following to get internet through: (Small guide I compiled after a lot of trial and error)

Make sure your DNS Resolver config is writeable:

* sudo chmod o+r /etc/resolv.conf

Temporarily change DNS to use Google's nameserver:

* sudo nano /etc/resolv.conf

Change IP to 8.8.8.8

CTRL+O to write out file.

CTRL+X to exit
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
kukamuumuka

Re: Losing DNS Name Resolution

Post by kukamuumuka »

You can make a script to the /etc/rc.local file for automating your commands.
Askey307

Re: Losing DNS Name Resolution

Post by Askey307 »

administrollaattori wrote: Thu Mar 08, 2018 5:17 pm You can make a script to the /etc/rc.local file for automating your commands.
Newbie question, how would I go about making a script for automating this? Also, is this a known problem?
kukamuumuka

Re: Losing DNS Name Resolution

Post by kukamuumuka »

Askey307 wrote: Fri Mar 09, 2018 2:42 am
administrollaattori wrote: Thu Mar 08, 2018 5:17 pm You can make a script to the /etc/rc.local file for automating your commands.
Newbie question, how would I go about making a script for automating this? Also, is this a known problem?
Add the next line before the last exit 0 into /etc/rc.local file.

Code: Select all

sleep 10 && sed -i 'd;4d' /etc/resolv.conf && echo "nameserver 8.8.8.8" >> /etc/resolv.conf
/etc/rc.local can be edited using nano.

Code: Select all

sudo nano /etc/rc.local
Askey307

Re: Losing DNS Name Resolution

Post by Askey307 »

administrollaattori wrote: Fri Mar 09, 2018 6:20 am
Askey307 wrote: Fri Mar 09, 2018 2:42 am
administrollaattori wrote: Thu Mar 08, 2018 5:17 pm You can make a script to the /etc/rc.local file for automating your commands.
Newbie question, how would I go about making a script for automating this? Also, is this a known problem?
Add the next line before the last exit 0 into /etc/rc.local file.

Code: Select all

sleep 10 && sed -i 'd;4d' /etc/resolv.conf && echo "nameserver 8.8.8.8" >> /etc/resolv.conf
/etc/rc.local can be edited using nano.

Code: Select all

sudo nano /etc/rc.local

That is super thank you mate. I'll give it a shot and if it works, i'll mark your post as the answer.
Askey307

Re: Losing DNS Name Resolution

Post by Askey307 »

administrollaattori wrote: Fri Mar 09, 2018 6:20 am
Askey307 wrote: Fri Mar 09, 2018 2:42 am
administrollaattori wrote: Thu Mar 08, 2018 5:17 pm You can make a script to the /etc/rc.local file for automating your commands.
Newbie question, how would I go about making a script for automating this? Also, is this a known problem?
Add the next line before the last exit 0 into /etc/rc.local file.

Code: Select all

sleep 10 && sed -i 'd;4d' /etc/resolv.conf && echo "nameserver 8.8.8.8" >> /etc/resolv.conf
/etc/rc.local can be edited using nano.

Code: Select all

sudo nano /etc/rc.local
Hey mate

Unfortunately no use. It keeps it for 3 boot ups then I have to re-apply everything again. So far the best option seems to backup and re-install. But that is the easy road. I would like to dig deeper and get a better understanding of Linux underlying principles.

Any other suggestions? I've already backed up everything so digging ain't a risk for me.
kukamuumuka

Re: Losing DNS Name Resolution

Post by kukamuumuka »

Askey307 wrote: Mon Mar 12, 2018 2:02 am Any other suggestions? I've already backed up everything so digging ain't a risk for me.
Maybe the simplest way is the best way?
viewtopic.php?f=53&t=264925&p=1442631#p1442631
Askey307

Re: Losing DNS Name Resolution

Post by Askey307 »

administrollaattori wrote: Mon Mar 12, 2018 4:11 am
Askey307 wrote: Mon Mar 12, 2018 2:02 am Any other suggestions? I've already backed up everything so digging ain't a risk for me.
Maybe the simplest way is the best way?
viewtopic.php?f=53&t=264925&p=1442631#p1442631

Natural for the human mind to over complicate things. Thank you mate. It works so far.
Askey307

Re: Losing DNS Name Resolution

Post by Askey307 »

Happened again, I have to edit the resolv.conf file everytime after a reboot to resolve 8.8.8.8 or get internet. The input of 8.8.8.8 under network settings does no good anymore.
Locked

Return to “Networking”