LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-29-2014, 01:27 PM   #1
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Rep: Reputation: Disabled
DNS settings get overwritten


Hi guys, Redhat guy trying to learn Debian here.

I've set up my interfaces ok and set them to static and I set up a bind server for DNS. But it seems like every so often resolv.conf gets overwritten with the DNS from DHCP. Network manager doesn't seem to be running and I can't understand why it keeps getting overwritten. Sure I could make it immutable using chattr (assuming that works ok in debian) but that's working round the issue.

Any ideas why this is happening or what I can do to stop it?
 
Old 07-29-2014, 02:15 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
When a DHCP server gives you a DNS server address, shouldn't it be updated?

My resolv.conf has this comment:

Quote:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
Code:
man resolvconf
 
Old 07-29-2014, 02:19 PM   #3
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Guttorm View Post
When a DHCP server gives you a DNS server address, shouldn't it be updated?

My resolv.conf has this comment:



Code:
man resolvconf
Yeah, I've got a really lightweight console install I've not installed network-manager or resolvconf so it (from what I can gather) shouldn't be being dynamically updated. I guess I should just change the DHCP but it really is just working round the problem. hmm.
 
Old 07-29-2014, 02:25 PM   #4
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Ok, and there it goes. I'll have to now figure out how to change the DNS settings in virsh net-edit in KVM.

Tsss... This is really silly. When I tell my network interface to not use DHCP I don't see why it should still try and get DNS settings from DHCP.
 
Old 07-29-2014, 02:30 PM   #5
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Sack it. I've just done a chattr +i on it.

Not very elegant, but it'll do the job.
 
Old 07-29-2014, 02:37 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Well,.. if you are positive it isnt NetworkManager.. You can always use auditing to find out what is changing it:

Code:
# Set up the audit
/sbin/auditctl -w /etc/resolv.conf -p war

# After the file changes use this to see the PID of the process that changed it
/sbin/ausearch -f /etc/resolv.conf
 
Old 07-29-2014, 02:41 PM   #7
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Well,.. if you are positive it isnt NetworkManager.. You can always use auditing to find out what is changing it:

Code:
# Set up the audit
/sbin/auditctl -w /etc/resolv.conf -p war

# After the file changes use this to see the PID of the process that changed it
/sbin/ausearch -f /etc/resolv.conf
Thankyou. Great idea.

What's the process name for networkmanager on debian just to make sure I'm not being a plonker.
I can't see it in services and if I grep -i for net in ps i only get [netns] which I think is network namespace which... I honestly don't know enough about.. It might be the culprit.
 
Old 07-29-2014, 07:44 PM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by kbnuts View Post
What's the process name for networkmanager on debian just to make sure I'm not being a plonker.
I can't see it in services and if I grep -i for net in ps i only get [netns] which I think is network namespace which... I honestly don't know enough about.. It might be the culprit.
if it is installed, you should be able to find out with
Code:
dpkg -L network-manager |grep bin
However, I suggest you just install resolvconf and let it deal with this issue for you.

Evo2.
 
Old 07-30-2014, 01:26 AM   #9
kbnuts
Member
 
Registered: Apr 2014
Posts: 45

Original Poster
Rep: Reputation: Disabled
Thanks guys, next lab machine I build (which will probably be in the next couple of days), I'll user resolvconf on.
 
Old 07-31-2014, 06:16 AM   #10
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
You have resolvconf* installed, which is trying to handle this for you "automagically". I would suggest removing it for a start. (*not to be confused with the resolv.conf configuration file).

I believe dhclient can still write to your resolv.conf regardless of if you setup a static address, but might be wrong about that. Editing the file and removing resolveconf should be enough.

There are more eloquent solutions but if the chattr solution works...

For DHCP, where you want to get an automatically assigned address, but specify your nameservers locally, edit dhclient.conf and add a suitable "prepend domain-name-servers" stanza.
 
Old 08-01-2014, 07:16 PM   #11
camelrider
Member
 
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 251

Rep: Reputation: 32
Cool

I liked your first suggestion (chattr -i)
 
  


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
[SOLVED] dns settings JJJCR Linux - Networking 1 12-14-2010 08:40 PM
Help - 'resolv.conf' being overwritten on startup with DNS from my old VPN settings MonkeyMagic23 Linux - Networking 4 01-18-2009 09:05 AM
Network settings / DNS Server settings uid0sd Linux - Newbie 3 02-22-2007 03:39 PM
DNS settings Awatemono-San Linux - Newbie 3 06-18-2006 09:24 AM
DNS settings stillme Linux - Networking 2 04-11-2004 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:59 AM.

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