[buug] DHCP: override name server conditionally

Ian Zimmerman itz at madbat.mine.nu
Tue Mar 27 20:02:50 PDT 2007


With the ISC DHCP client version 3, I would like to change the name server,
just as a "supersede domain-name-servers" line in dhclient.conf would do,
but _only_ if I am talking to a particular DHCP server.

The right place to change seems to be a script in dhclient-enter-hooks.d
that redefines the shell function make_resolv_conf.  The DHCP protocol
option dhcp-server-identifier seems to be almost right for this, except
that it contains the IP address which will be 192.168.0.1 in this case
(and also in other cases), not helpful.  Ideally I would have the MAC
address of the server.  Well, I could put an arp command in the script.
But that is getting really too hackish.

Hmm.  Since I control this particular DHCP server, maybe I can make it
return a recognizable hostname and use that as the condition.
Any other suggestions?

(Background: this is on a laptop that I use both at home and in other
locations.  My ISP's name servers are buggy, they demonstrably ignore
TTLs in some cases and cache stuff much longer.  So I want to avoid them.)

-- 
Experience with Asset Control an asset.



More information about the buug mailing list