[TriLUG] Ignoring certain DHCP options (specifically, DNS)
David Both
dboth at millennium-technology.com
Tue Feb 19 10:58:47 EST 2013
I just add the following lines to ifcfg-<interfacename> files:
DNS1=8.8.8.8
DNS2=8.8.4.4
DNS3=whatever other DNS you want to use.
Three is the magic number.
Works like a charm.
You can also add the DNS entries to your dhcpd.conf file subnet definition stanza.
option domain-name-servers 192.168.0.52, 8.8.8.8;
Using your own choice of name servers.
On 02/19/2013 10:43 AM, Aaron Schrab wrote:
> At 09:57 -0500 19 Feb 2013, Brian Henning <bhenning at pineinst.com> wrote:
>> So my question is: Is creating a dhclient.conf the only right solution to
>> tell dhclient to ignore DNS info from DHCP and leave my resolv.conf alone?
>
> The method I've used for a quick way to prevent dhclient from modifying my
> resolv.conf file is to just run `chattr +i /etc/resolv.conf` as root. This
> marks the file as being immutable, and will prevent even programs running with
> root privileges from modifying it unless the immutable flag is first removed,
> which can be done by simply substituting '-' for '+' in the chattr command.
>
> This does result in an error being displayed when the script started by
> dhclient attempts to replace that file, but as far as I've been able to tell
> it doesn't cause any actual problems.
--
*********************************************************
"I'd put my money on the sun and solar energy. What a source of power! I hope we
don't have to wait until oil and coal run out before we tackle that."
- Thomas Edison, in conversation with Henry Ford and Harvey Firestone, 1931
*********************************************************
David P. Both
--
*********************************************************
David P. Both, RHCE
Millennium Technology Consulting LLC
919-389-8678
dboth at millennium-technology.com
www.millennium-technology.com
www.databook.bz - Home of the DataBook for Linux
DataBook is a Registered Trademark of David Both
More information about the TriLUG
mailing list