<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.18.0">
</HEAD>
<BODY>
On Tue, 2008-03-18 at 23:15 -0400, Jim Kinney wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
You will need to have a host section for each machine identifiable by MAC address. In that section you can spec a host name to be applied. For example, I want my inkjet to always have the following settings:<BR>
<BR>
host HP_1100 {<BR>
hardware ethernet 00:01:e6:6a:89:ff;<BR>
fixed-address <A HREF="http://192.168.0.3">192.168.0.3</A>;<BR>
option host-name "HP Inkjet 1100";<BR>
}<BR>
<BR>
It will get the domain name from the earlier setting.<BR>
</BLOCKQUOTE>
<BR>
I had tried that (because a few of the devices on my network require static IP addresses), but the farthest this seems to go is the DNS server.<BR>
<BR>
It seems that if I want the domain name to actually be applied to the clients, I have to use a shell script as a hook into the DHCP client on the workstations. The following DHCP script seems to have done it, though it's probably slightly buggy:
<PRE>
#
# Update the system's domain name when a new DHCP lease is received. This
# is probably specific to Ubuntu (and maybe Debian) systems that use 127.0.1.1
# for the system's hostname/domainname.
#
# Install this file in /etc/dhcp3/dhclient-exit-hooks.d for it to become
# effective.
#
# Copyright (c) 2008 Michael B. Trausch <mike@trausch.us>, Released under the
# terms of the GNU GPL v3.
#
set_system_domain_name() {
NDN="$new_domain_name"
HN=`hostname`
NEW="127.0.1.1 $HN.$NDN $HN \\# Updated by SSDN"
sed "s|.*127.0.1.1.*|$NEW|g;" -i /etc/hosts
return 0
}
release_system_domain_name() {
HN=`hostname`
NEW="127.0.1.1 $HN"
sed "s|.*127.0.1.1.*|$NEW|g;" -i /etc/hosts
return 0
}
case $reason in
BOUND|RENEW|REBIND|REBOOT)
set_system_domain_name
;;
EXPIRE|FAIL|RELEASE|STOP)
release_system_domain_name
;;
esac
</PRE>
When I have a valid lease, this gives me the following in my <TT>/etc/hosts</TT> file:
<PRE>
127.0.0.1 localhost
127.0.1.1 sage.spicerack sage # Updated by SSDN
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
</PRE>
This seems to be doing the trick, though I am sure to find that I have missed a couple of final details. It seems that the system relies on the <TT>/etc/hosts</TT> file for finding its domain name, though. I haven't found a way to make the system derive its domain name from the DNS system or anything as of yet, though that would really be nice on my little network.<BR>
<BR>
--- Mike<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
--
Michael B. Trausch <A HREF="mailto:mike@trausch.us">mike@trausch.us</A>
home: 404-592-5746, 1 <A HREF="http://www.trausch.us">www.trausch.us</A>
cell: 678-522-7934 im: <A HREF="mailto:mike@trausch.us">mike@trausch.us</A>, jabber
Ubuntu Unofficial Backports Project: <A HREF="http://backports.trausch.us/">http://backports.trausch.us/</A>
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>