[TriLUG] Ignoring certain DHCP options (specifically, DNS)

Ken Mink ken.mink at gmail.com
Tue Feb 19 10:14:16 EST 2013


On 2/19/13 9:57 AM, Brian Henning wrote:
> Hi group,
>
> My ISP (TWC) has one of those oh-so-wonderful domain-not-found landing
> pages.  It's got an opt-out mechanism, but that opt-out mechanism doesn't
> actually work.  Of course, TWC service people don't seem to be very
> concerned.  One tech I spoke to suggested I use another DNS server.  For
> some reason, he didn't see the irony of instructing me not to use the
> product he was supporting.
>
> So anyway, that's exactly what I want to do; I want to use 8.8.8.8 /
> 8.8.4.4.  Problem is, any time my public DHCP lease expires, dhclient
> rewrites my resolv.conf with the DNS option from the new DHCP lease,
> pointing me back to TWC's servers.
>
> I've done some searching and I see references to modifying dhclient.conf,
> but my system (CentOS 5.8) doesn't have one (so apparently dhclient is
> operating completely on defaults?).
>
> 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?
> Is there some modification I could make to the interface's ifcfg script
> instead?  I'm much more comfortable modifying an existing file (ifcfg) than
> trying to create a complete one from scratch (dhclient.conf).
>
> Thanks!
> ~Brian
>
> ------------------------------------------------------
>            Brian Henning, Software Engineer
>
>      /\    Pine Research Instrumentation
>     //\\   2741 Campus Walk Ave, Bldg 100
>    ///\\\  Durham, NC 27705
>   ////\\\\ USA
>      ||
>      ||    phone: 919.782.8320
>            fax:   919.782.8323
>            email: bhenning at pineinst.com
> ------------------------------------------------------
>
>
>
Hey Brian,
   I've just been working on this exact problem for a different reason. 
I wanted my firewall/router machine to use my internal dns server so 
that it would be able to find my machines by name. You will need a 
dhclient.conf. Here's what I use to accomplish the this:
interface "eth0"
  {
   supersede host-name "YOURHOSTNAME";
   supersede domain-name "YOURDOMAIN";
   supersede dhcp-server-identifier 255.255.255.255;
   prepend domain-name-servers 8.8.8.8;
   request subnet-mask,
           broadcast-address,
           routers,
           domain-name,
           domain-name-servers,
           host-name;
   require routers,
           subnet-mask,
           domain-name-servers;
  }

You'll want to adjust the interface as needed. You can drop the host 
name and domain name lines if you don't need them.

Ken



More information about the TriLUG mailing list