Page 1 of 1

Losing DNS Name Resolution

Posted: Wed Mar 07, 2018 6:29 am
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

Re: Losing DNS Name Resolution

Posted: Thu Mar 08, 2018 5:17 pm
by administrollaattori
You can make a script to the /etc/rc.local file for automating your commands.

Re: Losing DNS Name Resolution

Posted: Fri Mar 09, 2018 2:42 am
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?

Re: Losing DNS Name Resolution

Posted: Fri Mar 09, 2018 6:20 am
by administrollaattori
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

Re: Losing DNS Name Resolution

Posted: Fri Mar 09, 2018 6:41 am
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.

Re: Losing DNS Name Resolution

Posted: Mon Mar 12, 2018 2:02 am
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.

Re: Losing DNS Name Resolution

Posted: Mon Mar 12, 2018 4:11 am
by administrollaattori
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

Re: Losing DNS Name Resolution

Posted: Sat Mar 17, 2018 4:52 am
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.

Re: Losing DNS Name Resolution

Posted: Mon Apr 16, 2018 5:55 am
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.