Subject: Re: dhclient - obtain hostname
To: None <netbsd-help@NetBSD.ORG>
From: MLH <MLH@goathill.org>
List: netbsd-help
Date: 10/17/2002 00:09:00
On 16 Oct 2002 18:25:08 -0500, Manuel Bouyer wrote:
> On Wed, Oct 16, 2002 at 09:29:37PM +0000, MLH wrote:
>> I am trying to obtain a hostname from a dhcp server. The domain's
>> DNS has a hostname associated with the ip it provides and I need
>> to use that.
>> 
>> $ /usr/bin/host <ip>   works correctly
>> 
>> $ cat dhclient.conf
>> interface "fxp0" {
>>            send dhcp-client-identifier xx:xx:xx:xx:xx:xx;
>>            request subnet-mask, broadcast-address, routers,
>>                 domain-name, domain-name-servers, host-name;
>>            require host-name, subnet-mask, domain-name-servers;
>>        }
>> 
>> new_host_name is always null, despite the 'require host-name'
>> 
>> -- 1) What am I doing wrong here? Everything else is working.
> 
> Are you sure your dhcp server sends a host name ? Maybe
> use tcpdump to make sure.

I can't tell - if it's null. I see nothing in the tcpdump (using
-X option to print hex/ascii) that looks like a hostname.

hops:1 xid:0xd5e393a Y:{my ip} S:{dhcp/bootpserver ip} G:{gateway ip} [|bootp]

If it's not sending host-name, why doesn't 'require host-name'
prevent it from obtaining a lease?

>> Using this, /etc/rc.d/dhclient restart  works great, however,
>> /usr/bin/host <ip> *usually* returns a null string on bootup.
> 
> Probably because resolv.conf or networking is not up at this point.

That's what I figured. Any ideas on how to locate the hostname
before other services start up?

Thanks