Setting hostname with DHCP
I have scoured the web and even read the generally helpful
Chapter 10 - Network Configuration from Debian Reference
but I cannot figure out how to set hostname and domain using
On my box, "Linux debian 2.4.18-bf2.4 #1 Son Apr 14 09:53:28
CEST 2002 i586 unknown," DHCP works fine in that it gets an
ip address and even an associated name for the computer, but
"hostname" returns "debian", "hostname -d" returns nothing,
and "hostname --fqdn" returns "debian".
The computer is most frequently plugged into a campus
network for long periods, and my preferred behavior for it
would be that it gets the hostname and domain via DHCP and
sets them. I cannot get a static ip address from the
administrator. I am stuck with DHCP, but it would be
helpful if the host and domain names were set from DHCP on
bootup. I usually but *not always* get the same IP address
and name, so I don't want to rely on setting /etc/hostname
Isn't there an option for /etc/dhclient.conf that will set
the system hostname and domain name after running dhcp?
BTW, here is the first line of my dhclient: # $Id:
dhclient.sh,v 184.108.40.206.2.1 2002/02/11 03:44:26 eparis Exp $
In my web browsing, I have seen some hacks, e.g., after
starting the network in rcS.d, extract the hostname with
ifconfig or even nslookup and then insert that text into
/etc/hostname (which at the moment contains "debian").
This seems inelegant, but let me know if it's the only way.
Michael Ash, Assistant Professor
of Economics and Public Policy
Department of Economics and CPPA
University of Massachusetts
Amherst, MA 01003
Tel 413-545-6329 Fax 413-545-2921