stop updating resolv.conf on DHCP

Gene Heskett gheskett at wdtv.com
Fri Jul 13 11:06:18 UTC 2012


On Friday 13 July 2012 07:01:05 Florin Andrei did opine:

> Multihomed server, external interface on DHCP, internal interfaces with
> fixed addresses. Server is running its own DNS resolver with Bind. So
> there's no need to update resolv.conf via the DHCP client.
> 
> I tried this in /etc/network/interfaces:
> 
> auto eth2
> iface eth2 inet dhcp
> dns-nameservers 127.0.0.1
> dns-search home.local
> 
> But then the DNS servers and domain provided by DHCP are still added to
> resolv.conf in addition to my own. I want to stop that altogether.
> resolv.conf must contain only my own DNS server and domain.
> 
> Is there a way to do this nicely, only relying on config scripts, or do
> I have to do it the hard way, modifying system scripts? (which would
> suck)
> 
> I can't believe there's no obvious solution to this simple problem. On
> Red Hat, I would just add PEERDNS=no to the interface config and the
> problem would be solved. :(

Can you not do that in your interfaces file now?

I had that sort of a problem once, but took the brute force approach to 
solving it.  Once I had resolv.conf to my liking, I did a "chmod +i 
resolv.conf" as root.  My laptops dhcp client didn't complain because it 
couldn't write to resolv.conf.  But that also means I keep a backup copy 
because when I take the lappy someplace else, it does need to be writable.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
BOFH excuse #374:

It's the InterNIC's fault.




More information about the ubuntu-users mailing list