[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Resolving hostnames using DHCP



On Sun, 6 Apr 2003 16:10:45 +0000 Clive Menzies wrote:
> Hi Reaz
> 
> I've got the nameservers in resolv.conf and so resolving public IP's
> is fine.  It's the hosts on the local network that don't resolve.  I
> tried including the DHCP server's  IP address as a name server but
> that gave some strange errors and didn't help.

Desperate people do the strangest things... :)

> I've also got the nameservers referred to in dhcpd.conf.

Cool, then your client machines are able to resolve external hostnames,
without having to specify any nameservers by hand on each of them.

> I'm sure I'm missing something obvious ;-)

Same problem here.

Instead of messing with bind's dynamic updates, I made a bash script
that parses the dhcp server's log file for the host names and IP
addresses of its clients, then adds that information to /etc/hosts as
<ip> <hostname> pairs, one per line.

Cron runs the script every few minutes (though that's probably a little
paranoid since DHCP-given IPs, in my experience, tend to stick to their
machines), and I never had any trouble accessing the 20-odd machines in
my network since.

Just be *very careful* when automatically editing your /etc/hosts, make
sure you have a backup of it handy.

-- 
Carlos Sousa
http://vbc.dyndns.org/



Reply to: