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

Setting hostname with DHCP



Dear list,

I have scoured the web and even read the generally helpful
Chapter 10 - Network Configuration from Debian Reference
http://www.debian.org/doc/manuals/reference/ch-gateway.en.html,
but I cannot figure out how to set hostname and domain using
dhcp.

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
permanently.

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 1.1.1.1.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.

Best regards,

Michael


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
Email mash@econs.umass.edu
http://people.umass.edu/maash



Reply to: