LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-11-2016, 10:57 PM   #1
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Rep: Reputation: 30
Losing nameserver in resolv.conf in new Debian install.


I've a brand new install of Debian and am having difficulty with my wireless connection.

I've set up the network-manager so that my nameservers are 8.8.8.8 and 8.8.4.4 and when I connect everything is fine.

After a while, though, connection drops as the DNS fails and I have to disconnect and reconnect to get full functionality.

At the start of the connection, my /etc/resolv.conf contains the following:
Code:
dave@threepwood:~$ sudo cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 10.0.0.2
nameserver 8.8.8.8
nameserver 8.8.4.4
But after a while something changes it to this:
Code:
dave@threepwood:~$ sudo cat /etc/resolv.conf 
nameserver fe80::1%wlan0
What could be changing my resolv.conf and how can I stop it?
 
Old 11-12-2016, 02:04 AM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 713

Rep: Reputation: 214Reputation: 214Reputation: 214
Are you using DHCP (especially dhclient) some place? That will over-write it. I don't have NetworkManager, but maybe look to /etc/dhclient.conf. It was doing similar here. Here's mine now (edit to your system if needed):

Code:
## dhclient.conf
##
## Configuration file for ISC dhclient (see 'man dhclient.conf')
## Note that two seperate runs are needed for dhclient for ipv4 
## and ipv6 prefix delegation. 

# Default options
timeout 45;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;

# TWC nameservers suck, with their DNS-search crap
# do not use what they give.
supersede domain-name-servers 8.8.8.8, 8.8.4.4;

## EOF
If you're not using dhclient, check other dhcp/bootp clients as they usually assign domain name servers.
 
Old 11-12-2016, 02:21 AM   #3
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
Thanks!

Here is my dhclient.conf:

Quote:
# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
# few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
#}

#lease {
# interface "eth0";
# fixed-address 192.33.137.200;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.33.137.255;
# option routers 192.33.137.250;
# option domain-name-servers 127.0.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
#}
I don't see an option to "supersede domain-name-servers 8.8.8.8, 8.8.4.4;" in my default configuration, so I'll add that and see if it makes a difference.
 
Old 11-12-2016, 02:46 AM   #4
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
Nope.

Code:
 sudo cat /etc/resolv.conf 
nameserver fe80::1%wlan0
 
Old 11-12-2016, 08:00 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by cov View Post
Nope.
Code:
~]$ egrep -ie "^(\[main|dns=)" /etc/NetworkManager/NetworkManager.conf
[main]
dns=none
...and see 'man 5 NetworkManager.conf' for explanation?
 
Old 11-12-2016, 08:51 AM   #6
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
Hi Unspawn.

Quote:
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false
It appears that the Networkmanager is updating the resolv.conf (which, according to "man 5 NetworkManager.conf" is the default) and this is confirmed by the fact that reconnecting to the wireless device rewrites the resolv.conf to it's correct (or rather functional) configuration.

Something else is overwriting the file and removing the IPv4 nameserver entries.

I tried to remove the write permissions on the file (chmod 444 /etc/resolv.conf) but this doesn't work either.
 
Old 11-12-2016, 07:26 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
I gave you a hint ("dns=none") and an explanation ('man 5 NetworkManager.conf').
 
Old 11-13-2016, 12:13 AM   #8
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
That doesn't make sense to me.

Possibly because I'm assuming that the Networkmanager is the good guy and is resetting the resolv.conf to a usable configuration every time I invoke it by disconnecting and reconnecting. If that is the case, then disabling that action by setting dns=none strikes me as counter productive.

Nevertheless, I will do as you suggest and report back.
 
Old 11-13-2016, 12:52 AM   #9
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
As suspected, changing the Networkmanager configuration to dns=none means that when the resolv.conf is shorn of the IPv4 nameserver settings, the Networkmanager does not overwrite it with a usable configuration.

So disconnecting and reconnecting no longer gives me a short period wherein the DNS actually works.

As an aside, I really don't mind being sneered at as long as I'm receiving helpful advice.
 
Old 11-13-2016, 05:27 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by cov View Post
changing the Networkmanager configuration to dns=none means that when the resolv.conf is shorn of the IPv4 nameserver settings, the Networkmanager does not overwrite it with a usable configuration.
There's actually two things to do:
0) unlink /var/run/NetworkManager/resolv.conf,
1) activate "dns=none" in the main section of /etc/NetworkManager/NetworkManager.conf (might need to restart the service to make changes stick),
2) populate /etc/resolv.conf as required.

Works for me.
 
Old 11-14-2016, 04:39 AM   #11
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
My original question in the OP was "What could be changing my resolv.conf and how can I stop it?"

As far as I can see Networkmanager updates the resolv.conf file to the nameservers specified under the nm-applet under the IPv4 settings tab wherein one can specify nameservers.

Therefore disabling this by using the 'dns=none' directive just prevents the correct settings from being implemented.

As a temporary measure until I can work out what process is purging my resolv.conf file of IPv4 settings, I've run the following command:

Code:
sudo chattr +i /etc/resolv.conf
This stops the resolv.conf from being overwritten which has allowed my internet access some stability.

This is not a permanent solution.
 
Old 11-15-2016, 02:00 PM   #12
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Rep: Reputation: 229Reputation: 229Reputation: 229
NetworkManager is changing it. Just make the change in the NetworkManager gui tool. It will save the settings for each network you connect to. I dont particularly like NetworkManager for desktops, and oviously servers, But I love it for laptops. It saves settings for each network you use.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Useage of nameserver ips in /etc/resolv.conf VolkHe Linux - Server 34 12-21-2014 12:42 PM
Secondary nameserver resolv.conf not queried hansaplazt Linux - Networking 6 12-08-2010 05:41 AM
nameserver entries in /etc/resolv.conf Ron7 Linux - Software 11 09-03-2010 04:18 PM
resolv.conf nameserver ordering/priorities jmoschetti45 Linux - Networking 6 01-25-2010 12:27 PM
pppd: nameserver -> /etc/resolv.conf ?? tredegar Linux - Networking 6 03-21-2004 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration