Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Friday, September 11, 2009

Unknown hostname for Solaris 10 DHCP client

Unknown hostname for Solaris 10 DHCP client

When I installed Solaris 10 x86, my computer thought its hostname was unknown. Aside from being annoying, this seemed to be causing a few issues, so I set about trying to set it to a name of my choice.

Using the uname -S hostname command set the hostname for me but this information didn’t persist on reboot. A bit of googling turned up various references to editing /etc/init.d/network so that it read /etc/nodename and set the hostname accordingly (as well as a script to set the hostname), but my system didn’t have an /etc/nodename file.

I understood that /etc/nodename should contain my computer’s name, but didn’t know if any other settings were required (I later found Jeff Hunter’s TCP/IP quick configuration guide, which confirmed that the file just contains the computer’s name - in my case laptop3).

It turns out that these hacks are for Solaris 8/9 - Solaris 10 is quite happy to set the hostname based on the contents of /etc/nodename. Once I had created /etc/nodename and rebooted, /etc/hosts read:

# Internet host table
# localhost laptop3 # Added by DHCP

and the computer was no longer anonymous!

Method 2:

How to Enable a Solaris DHCPv4 Client to Request a Specific Host Name

  1. On the client system, edit the /etc/default/dhcpagent file as superuser.

  2. Find the REQUEST_HOSTNAME keyword in the /etc/default/dhcpagent file and modify the keyword as follows:


    If a comment sign (#) is in front of REQUEST_HOSTNAME, remove the #. If the REQUEST_HOSTNAME keyword is not present, insert the keyword.

  3. Edit the /etc/hostname.interface file on the client system to add the following line:

    inet hostname

    hostname is the name that you want the client to use.

  4. Type the following commands to have the client perform a full DHCP negotiation upon rebooting:

    # ifconfig interface dhcp release
    # reboot

    The DHCP data that is cached on the client is removed. The client restarts the protocol to request new configuration information, including a new host name. The DHCP server first makes sure that the host name is not in use by another system on the network. The server then assigns the host name to the client. If configured to do so, the DHCP server can update name services with the client's host name.

    If you want to change the host name later, repeat Step 3 and Step 4.