Subject: Re: Trouble configuring DHCP
To: None <port-i386@NetBSD.ORG>
From: MLH <MLH@goathill.org>
List: port-i386
Date: 06/08/2003 18:03:11
On 7 Jun 2003 17:05:03 -0500, Soren Jacobsen wrote:
> On 06/07 11:19, Yasir Malik wrote:
>> Thank you very much! Right now I am writing this message on my laptop.
>> My sysadmin, who, by the way, takes long vacations, kept telling me that I
>> was not following the directions properly. Also, is there a way to set my
>> hostname. dhcp automatically assigns me my hostname (r-ymalik).
>
> This was covered in another message in this thread, but:
> supersede [ option declaration ] ;
>
> If for some option the client should always use a locally-
> configured value or values rather than whatever is sup-
> plied by the server, these values can be defined in the
> supersede statement.
>
> host-name is the option you want.
About a year ago I set up dhclient with a server which doesn't
provide a hostname on request. I tried setting dns queries in
several parts of the boot sequence (dhclient-exit-hooks etc.), but
the only place I could find that allowed the network to come up
enough to use it was rc.local, where I used something like :
new_ip_address=`ifconfig fxp0 | grep "inet " | cut -f2 -d" "`
new_host_name=`/usr/bin/host $new_ip_address | cut -f5 -d" "`
hostname $new_host_name
old_ip_address=`cat /etc/myip`
if [ "$old_ip_address" != "$new_ip_address" ]; then
echo $new_ip_address >| /etc/myip
fi
(I think)
What would be a better way to determine and set a real hostname in
such a situation?