resolv.conf gets reset (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
twigboy
Posts: 10
Joined: Thu 21 Apr 2016, 03:16

resolv.conf gets reset (Solved)

#1 Post by twigboy »

I have found that despite getting a wifi connection, internet (meaning dns) is not accessible because resolv.conf is periodically resetting to an empty default. Meaning, it's empty except the default comments about resolv.conf.head and .tail. Sometimes it is on startup.
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line
Where do I go to get this fixed? Xenialpup. Using it for a well over a year but this started the other day. Tried the various network programs to set wifi -- same results. I've reset the router also. So what triggered this problem?

Thanks.
David.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

Re: resolv.conf gets reset

#2 Post by s243a »

twigboy wrote:I have found that despite getting a wifi connection, internet (meaning dns) is not accessible because resolv.conf is periodically resetting to an empty default. Meaning, it's empty except the default comments about resolv.conf.head and .tail. Sometimes it is on startup.
# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line
Where do I go to get this fixed? Xenialpup. Using it for a well over a year but this started the other day. Tried the various network programs to set wifi -- same results. I've reset the router also. So what triggered this problem?

Thanks.
David.
Create a file called "/etc/resolv.conf.head" and put your preferred DNS servers there.
Find me on [url=https://www.minds.com/ns_tidder]minds[/url] and on [url=https://www.pearltrees.com/s243a/puppy-linux/id12399810]pearltrees[/url].

twigboy
Posts: 10
Joined: Thu 21 Apr 2016, 03:16

Re: resolv.conf gets reset

#3 Post by twigboy »

s243a wrote: Create a file called "/etc/resolv.conf.head" and put your preferred DNS servers there.
Thanks. That works. I was able to get the dns server info from another notebook, but how would I know what to put in there from another wifi, such as at a hotel?

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

Re: resolv.conf gets reset

#4 Post by s243a »

twigboy wrote:
s243a wrote: Create a file called "/etc/resolv.conf.head" and put your preferred DNS servers there.
Thanks. That works. I was able to get the dns server info from another notebook, but how would I know what to put in there from another wifi, such as at a hotel?
The dhcpd daemon usually does this automatically for you based on info from your router/gateway and the isp that it is connected to. Typically one only specifies an alternate when they want to use an alternative dns server for:
1. better privacy,
2. censorship circumventation
3. better dns lookup speeds.

For instance, one might accomplish:
#3 by using a dns caching server on their local network.
#1 by using vpn, dnscrypt (or possibly tor but tor might not be as reliable as the other two options).
#2 might be accomplished by using a dns server located in the country of the site that you want to visit.

If dhcpd is not doing this automatically for you then it may be the case that your router is incorrectly configured or less likely that your dhcpd daemon is not running or doesn't have write permission to this file.

As a final note, if you know the ip addresses of the sites you want to visit then you could use a "host file", which will allow you to access the sites if for some reason your dns servers aren't working. However, a host file won't automatically update if the ip address of the site changes (which might have security implications) and it won't get the speed benefits of geographic load balancing, which might be used in a CDN (content distribution network) such as cloudflare.
Find me on [url=https://www.minds.com/ns_tidder]minds[/url] and on [url=https://www.pearltrees.com/s243a/puppy-linux/id12399810]pearltrees[/url].

twigboy
Posts: 10
Joined: Thu 21 Apr 2016, 03:16

Re: resolv.conf gets reset

#5 Post by twigboy »

s243a wrote: If dhcpd is not doing this automatically for you then it may be the case that your router is incorrectly configured or less likely that your dhcpd daemon is not running or doesn't have write permission to this file.
That another puppylinux works fine on this router, as does a number of Windows and a Mac ibook , I think the router is fine. So I'll have to look into the dhcpd situation. Thanks for that tidbit.

twigboy
Posts: 10
Joined: Thu 21 Apr 2016, 03:16

#6 Post by twigboy »

It occurred to me to put the lines in /etc/resolv.conf.tail instead of .head so that when connecting to a new router it should (hopefully) pickup the dns correctly, but if not it will default to:
nameserver 10.0.0.1
nameserver 8.8.8.8
I tested this, and used nslookup to see that the first nameserver is used succesfully (I switched them to see the results change). Here it used the Comcast 10.0.0.1
root# nslookup 8.8.8.8
Server: 10.0.0.1
Address 1: 10.0.0.1 Docsis-Gateway.hsd1.va.comcast.net

Name: 8.8.8.8
Address 1: 8.8.8.8 dns.google
Switching the order to Google's first
root# nslookup 8.8.8.8
Server: 8.8.8.8
Address 1: 8.8.8.8 dns.google

Name: 8.8.8.8
Address 1: 8.8.8.8 dns.google
Does this sound right?

Post Reply