Re: hostname with DHCP
- From: "Glenn" <eponymousalias@xxxxxxxxx>
- Date: 30 Nov 2005 16:00:25 -0800
KarlD wrote:
> ## 1. Put the name you want in one line in file /etc/nodename
> (as mentioned by others) ##
>
> I need to take back these steps for Solaris 10.
> Just rebooted my system and apparently only entering a hostname
> in /etc/nodename did not seem to work under my DHCP client
> environment in Solaris 10 as it used to do in Solaris 8.
> The network never came up and the Solaris CDE forced
> me to log on in fail-safe mode and required me to verify and
> edit /etc/hosts and some other config files. I suppose
> I will have to live with hostname 'unknown' for now unless
> it causes problem in confguring sendmail.
>
> After boot my /etc/hosts looks like:
> 127.0.0.1 localhost
> 192.168.1.100 unknown # Added by DHCP
An issue with the Solaris 10 FCS /lib/svc/method/net-svc script,
invoked during DHCP configuration at boot time, is that it destroys
the fully-qualified hostname in /etc/hosts. The FQHN is needed
by sendmail, however (/usr/sbin/check-hostname shows a problem).
Fixing this automatically at boot time requires a modification to the
net-svc script, to include the FQHN on the same line as the bare
hostname (pardon the wrapping of a few of these lines by the
Google newsreader; I cannot override it):
*** net-svc.orig Fri Jan 21 15:38:22 2005
--- net-svc Sun Jun 12 16:56:06 2005
***************
*** 137,143 ****
#
/usr/bin/sed -e "/^[ ]*${ipaddr}[ ]/d" \
/tmp/${filename}_clear.$$ >/tmp/${filename}.$$
! echo "${ipaddr}\t${hostname}\t# Added by DHCP" \
>>/tmp/${filename}.$$
else
#
--- 137,143 ----
#
/usr/bin/sed -e "/^[ ]*${ipaddr}[ ]/d" \
/tmp/${filename}_clear.$$ >/tmp/${filename}.$$
! echo "${ipaddr}\t${hostname}\t${hostname}.${domain}\t#
Added by DHCP" \
>>/tmp/${filename}.$$
else
#
***************
*** 170,176 ****
#
/usr/bin/mv /tmp/${filename}_clear.$$ \
/tmp/${filename}.$$
! echo "${ipaddr}\t${hostname}\t# Added by DHCP"
\
>>/tmp/${filename}.$$
fi
fi
--- 170,176 ----
#
/usr/bin/mv /tmp/${filename}_clear.$$ \
/tmp/${filename}.$$
! echo
"${ipaddr}\t${hostname}\t${hostname}.${domain}\t# Added by DHCP" \
>>/tmp/${filename}.$$
fi
fi
Also note the following about hostname selection. The hostname by
which the Sun box is known on the DHCP interface (hme1 in my case) is
not, in fact, drawn from the /etc/hostname.hme1 file (though you want
to, if only as a courtesy for other software which may depend on that
file, insert that hostname there). Instead, the hostname is taken from
the Hostname option value provided by the DHCP server, or if no such
value is provided, the value in /etc/nodename is used. Alas, the
SpeedStream 5100-b (my DSL modem) provides no way to configure this
client hostname, so its DHCP server does not provide the Hostname
option back to the DHCP client on the Sun box, and the /etc/nodename
value ends up being used for this interface. The practical effect is
that the DHCP-interface name becomes the de-facto machine name (the one
returned by hostname and by uname -n). This may not be what you had in
mind to start with if your machine has other network interfaces. There
doesn't seem to be any good way around this, so be prepared to use some
other hostname(s) for the machine's other IP address(es).
Also note the following complication. Even with the net-svc adjustment
shown, other hostname aliases for this machine can still get lost if
they are associated with this interface. Typical aliases you will care
about in this context are mailhost, mailhost.domainname, and loghost.
In my case, I attached these aliases to the hme0 interface hostname, so
they do not get destroyed by the startup processing. If your machine
has only one Ethernet interface, you may need further adjustments to
the net-svc script to preserve these extra aliases as well.
So to configure my machine, I logged out, started a Command Line Login
session as root, and ran sys-unconfig to reset the machine's
configuration and get it to install most of the DHCP stuff using its
own configuration procedures. There were some tricks to configuring
the machine during the setup menus once it rebooted.
* If you've been operating your machine beforehand, you should save a
copy of /etc/inet/hosts before running sys-unconfig and the
reconfiguration, because its contents will be destroyed. That way,
you can easily reconstruct the deleted information afterward.
* You should have in hand the hostnames and IP addresses you wish to
assign for all of the non-DHCP network interfaces.
* The Ethernet interface you want to run DHCP on must be selected as
the primary network interface, even if it's not the first one
listed or the one you otherwise think of as the principal interface
in your machine's context. This selection is necessary in order to
get the hosts file constructed correctly (both DHCP and non-DHCP IP
addresses listed). It does have one unfortunate side effect that
must be repaired later: the loghost alias gets lost.
* Some necessary configuration is not completed by the
reconfiguration menus and boot-time setup. The missing required
steps are listed below.
* I selected "None" as the default route for non-DHCP interfaces, and
this worked fine.
* I selected "None" as the local name service, and this worked fine.
Enough stuff gets configured automatically that the system is still
able to resolve external network addresses such as www.google.com .
With the net-svc script modification above in place, the remaining
steps for DHCP setup are rather easy. Assuming your chosen DHCP
hostname is spider and your chosen local domain name (domainname) is
web, you just type:
su -
cd /etc
echo > dhcp.hme1
echo spider > nodename
echo spider > hostname.hme1
echo web > defaultdomain
vi hosts
(add aliases for mailhost, mailhost.domainname, and loghost to
a non-DHCP host entry; add IP addresses and hostnames for other
machines on your network; perhaps add an IP address and
hostname for the DSL modem as well)
sync
reboot
I'm hoping that most if not all of these issues will be addressed
in a future update to S10.
.
- Follow-Ups:
- Re: hostname with DHCP
- From: KarlD
- Re: hostname with DHCP
- From: KarlD
- Re: hostname with DHCP
- References:
- Re: hostname with DHCP
- From: KarlD
- Re: hostname with DHCP
- Prev by Date: Re: Downloading 3/05 x86??? Point to SPARC files!
- Next by Date: Monitoring disk IO on SANs
- Previous by thread: Re: hostname with DHCP
- Next by thread: Re: hostname with DHCP
- Index(es):
Relevant Pages
|