Linode Overwriting /etc/resolv.conf

I've made changes to /etc/resolv.conf (to get a name server working), but my linode (running Debian 5.0) keeps replacing that with the linode installation's default.

How can I stabilize the file to my configuration? I'd like to either stop whatever is over-writing it, or have it over-written with the settings I need.

Thanks in advance.

8 Replies

The DHCP client, dhclient3, is doing it. It gets a list of nameservers over DHCP and stuffs them in /etc/resolv.conf.

Why do you need a completely custom /etc/resolv.conf? What do you mean by "to get a name server working"?

I don't know how to get it to stop messing with /etc/resolv.conf completely. I do know that it's easy to get dhclient3 to prepend a custom server to the list – see /etc/dhcp3/dhclient.conf. In the end, I stopped using DHCP, so I don't have to deal with it anymore. :D

I'm running an authoritative name server for a domain of my own off the linode. I find that nslookup doesn't work properly if I don't set "domain" in resolv.conf to that of my domain, and remove the "search" directive in the linode default. I also have to add "nameserver 127.0.0.1" to the list of nameservers, and before any other nameserver directives.

I don't know how important that nslookup test is, but it's one of the diagnostics in "DNS and BIND" and I'm more comfortable having it work.

The manual shows a "supersede" statement that allows designation of values for options; perhaps I ought to use that.

Or, turn off dhcp entirely. Do I need it? I presume it's in the default installation for some reason.

Ahh, right, you're the person from that other thread. :D

@chernevik:

I'm running an authoritative name server for a domain of my own off the linode. I find that nslookup doesn't work properly if I don't set "domain" in resolv.conf to that of my domain, and remove the "search" directive in the linode default. I also have to add "nameserver 127.0.0.1" to the list of nameservers, and before any other nameserver directives.

Ehh. You shouldn't need to put your authoritative server in /etc/resolv.conf. That's…really strange.

@chernevik:

I don't know how important that nslookup test is, but it's one of the diagnostics in "DNS and BIND" and I'm more comfortable having it work.

If "DNS and BIND" says something should work, it probably should, but that doesn't mean you're going about it the right way.

@chernevik:

The manual shows a "supersede" statement that allows designation of values for options; perhaps I ought to use that.

My old dhclient.conf contains:

supersede domain-name "mydomain.com";
prepend domain-name-servers 127.0.0.1;

among all of the other things.

(I run a local recursive nameserver.)

@chernevik:

Or, turn off dhcp entirely. Do I need it? I presume it's in the default installation for some reason.

It's up to you. DHCP configures your networking settings automatically. On a Linode, the settings will change so infrequently that you can set it up manually if you want to, but it's not necessary.

@mnordhoff:

Ahh, right, you're the person from that other thread. :D

Yes. Hello.

> Ehh. You shouldn't need to put your authoritative server in /etc/resolv.conf. That's…really strange.

Well, I thought I needed it, but some experimentation shows I don't now, so perhaps the need was related to some other problem. And now that I look at it, the book says don't use the local loopback address, so that's a fix. But without some reference to the local nameserver the result from the linode servers is "not authoritative".

> My old dhclient.conf contains:

supersede domain-name "mydomain.com";
prepend domain-name-servers 127.0.0.1;

I'll look into something like that, with a further option for the search directive. Turning off DHCP probably involves more research.

Thank you for your help.

@chernevik:

Well, I thought I needed it, but some experimentation shows I don't now, so perhaps the need was related to some other problem. And now that I look at it, the book says don't use the local loopback address, so that's a fix. But without some reference to the local nameserver the result from the linode servers is "not authoritative".

That's fine – that just means Linode's nameservers had to ask the domain's nameservers (that's you!) for the information, and as such, they merely have second-hand knowledge. This isn't a problem.

It's generally a good idea to keep your authoritative nameservers (the ones with the zone configurations) different than your recursive nameservers (the ones you put in resolv.conf), although for small installations, it doesn't matter too much. As God is my witness, however, when those small installations become large… :shock:

Hey there.

Having the same issue with overwriting etc/resolv.conf on reboot on CentOS 5. I need to set a search directive for my domain.

It's defintely related to dhclient-script as resolv.conf looks like this:

; generated by /sbin/dhclient-script
search members.linode.com
nameserver 97.107.133.4
nameserver 207.192.69.5
nameserver 207.192.69.4

I don't have DHCP enabled in any of my /etc/sysconfig/network-scripts/ifcfg-* scripts either since I have a couple aliases setup.

Finally, I can't find any dhclient config files:

# find / -name dhclient*
./usr/share/man/man5/dhclient.leases.5.gz
./usr/share/man/man5/dhclient.conf.5.gz
./usr/share/man/man5/dhclient-eval.5.gz
./usr/share/man/man5/dhclient-options.5.gz
./usr/share/man/man8/dhclient.8.gz
./usr/share/man/man8/dhclient-script.8.gz
./usr/share/doc/dhclient-3.0.5
./usr/share/doc/dhclient-3.0.5/dhclient.conf.sample
./var/run/dhclient-eth0.pid
./var/lib/dhclient
./var/lib/dhclient/dhclient-eth0.leases
./sbin/dhclient-script
./sbin/dhclient

Anyone have any tips? Cheers!

@turb0chrg:

Anyone have any tips? Cheers!
yum remove dhclient (which probably isn't its name, which I'd find for you but…eh).

That's exactly what it's called. I removed it and will reboot later to test it but I don't suspect any issues.

Thanks.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct