Fix: No hostname when using DHCP in Sun Solaris 8/9/10


If you are using DHCP to receive IP Address for your Sun Solaris system, you may end up with no hostname assigned to the system. This can be confirmed when there is no hostname at the prompt or if the output for the command “hostname” is as follows:

# hostname
unknown

or the /etc/hosts file has an entry as follows:

# cat /etc/hosts
#
# Internet host table
#
127.0.0.1 localhost
192.168.0.3 unknown # Added by DHCP


This happens when the DHCP server doesn’t provide a hostname for your server. Most of the DHCP Servers or routers acting as a DHCP Server doesn’t provide a hostname and Solaris DHCP agent relies on the DHCP server for its hostname.

To fix this problem, edit the dhcpagent config and set it not to request a Hostname from the DHCP server and then add a hostname to the /etc/hosts & /etc/nodename file.

Edit DHCPAGENT config

[For Solaris 10, this is not required as setting the hostname in /etc/nodename overrides the hostname provided by the DHCP Server. Move onto the next step]

Edit the dhcpagent config file /etc/default/dhcpagent with your favorite editor

# vi /etc/default/dhcpagent

and look for

PARAM_REQUEST_LIST=1,3,6,12,15,28,43

and remove the Parameter “12” from the above to look as follows:

PARAM_REQUEST_LIST=1,3,6,15,28,43

and save the file.

Now, add the hostname to the /etc/nodename & /etc/hosts as follows

# vi /etc/nodename

and add the hostname you want it to have (solarisserver for me)

# cat /etc/nodename
solarisserver

and edit the /etc/hosts file

# vi /etc/hosts

and add the line similar to the following

192.168.0.3 solarisserver loghost

Now,reboot the server and you should be all fine with hostname set for the system.

# init 6

9 thoughts on “Fix: No hostname when using DHCP in Sun Solaris 8/9/10”

  1. Hi,
    I tried the steps given in this article.
    But the problem is not completely eliminated.
    I have given the hostname as hpsolaris.
    During startup it says.

    “My unqualified hostname(hpsolaris): Sleeping for retry”

  2. Question: If DHCP gives out a different IP address next week, will the new IP address be propogated to the hosts table, or will I have a new problem???

  3. Great post!

    I tried another tips on another sites and
    nothing worked.
    I tried then these instructions and worked great
    (on a solaris 10 x86).

    Thanks!

  4. Thanks for this! Very simple and easy article to understand.

    I have the same question as Carey Schug (above). Does the /etc/hosts file gets updated with a new IP when the DHCP server gives a new IP to the client?

  5. Excellent post. I was able to assign a Static IP for my solaris VM, but the hostname was coming up unknown set by the DHCP. Your article helped me fix the problem.

    Thanks!!

  6. Hi, I’m trying to configure a DHCP server, but I can not, presumably the server is already running, because when I run dhcpconfig-Sq is running, but the client does not resolve the IP address, I know how to configure it from scratch, to see which have been my fault, and if I could say that files set up, thanks

  7. Hi,
    I removed the 12 from /etc/default/dhcpagent.
    cat /etc/nodename
    shows
    sonne
    In /etc/hosts
    I changed
    192.168.178.20 unknown # Added by DHCP
    to
    192.168.178.20 sonne loghost

    After rebooting the /etc/hosts file is changed and instead of “sonne” there is
    192.168.178.20 unknow loghost

    What is wrong?
    It would be creat if you could help.
    Kind regards,
    Niklo

Leave a Comment

Your email address will not be published. Required fields are marked *