Losing DNS Name Resolution

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
Post Reply
Askey307
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Losing DNS Name Resolution

Post by Askey307 » Wed Mar 07, 2018 6:29 am

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

User avatar
administrollaattori
Level 14
Level 14
Posts: 5150
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Losing DNS Name Resolution

Post by administrollaattori » Thu Mar 08, 2018 5:17 pm

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

Askey307
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Re: Losing DNS Name Resolution

Post by Askey307 » 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?

User avatar
administrollaattori
Level 14
Level 14
Posts: 5150
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Losing DNS Name Resolution

Post by administrollaattori » 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

Askey307
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Re: Losing DNS Name Resolution

Post by Askey307 » Fri Mar 09, 2018 6:41 am

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
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Re: Losing DNS Name Resolution

Post by Askey307 » Mon Mar 12, 2018 2:02 am

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.

User avatar
administrollaattori
Level 14
Level 14
Posts: 5150
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Losing DNS Name Resolution

Post by administrollaattori » 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

Askey307
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Re: Losing DNS Name Resolution

Post by Askey307 » Sat Mar 17, 2018 4:52 am

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
Level 1
Level 1
Posts: 45
Joined: Wed Mar 07, 2018 6:25 am
Location: South Africa

Re: Losing DNS Name Resolution

Post by Askey307 » Mon Apr 16, 2018 5:55 am

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.

Post Reply

Return to “Other networking topics”