[nSLUG] hostname, /etc/hosts, DHCP

Oliver Doepner odoepner at gmail.com
Sat Feb 24 11:51:33 AST 2007


thank you for your reply, Doug.

Doug McComber wrote:
 > To change this behaviour so that your laptop uses the values it
 > specifies you need to edit the DHCP client script for each interface
 > so that it tells the DHCP server that it already has a hostname and
 > domainname thank you very much, keep yours. I can't remember the
 > specific files for this in Debian but you will find them somewhere in
 > the heirarchy of /etc/sysconfig. And the value you need to modify or
 > add is something like:
 > DHCP_HOSTNAME=myhostname.mydomain

Setting environment variables somewhere in /etc/sysconfig seems 
Redhat-ish. ;)

 > Or something similar (anyone know the syntax for sure). Once you've
 > done this your /etc/hosts file is still valid, but just for looking up
 > ip address (which is it's purpose).

Well, the IP address(es) are not statically configured on the client 
(i.e. the laptop). They are configured as "static leases" at the DHCP 
server on the router.

The static lease table is basically a configurable mapping from MAC 
addresses to IP addresses (in the range 192.168.1.x) with an optional 
hostname setting.

I found the DHCP client config file on Debian/Ubuntu and I am trying the 
following now (in /etc/dhcp3/dhclient.conf):

send host-name "satellite";

And I have removed "host-name" from the list after "request" in that file.

Also I removed all hostname definitions from the static lease table on 
the router.

And I have changed /etc/hosts according to the new Debian policy of not 
putting the hostname as an alias for localhost but on a seperate "local" 
line: localhost satellite.local satellite

This makes sense to me. The name of "local network" is now simply 
"local". The latter is necessary for "hostname -f" and "hostname -s" to 
work without "unknown host" error.


Oliver Doepner


More information about the nSLUG mailing list