Setting Host name in Solaris

Posted on 2004-10-27
Last Modified: 2013-12-21
I would like to set the hostname to Jack.
I have set the configuration as follow:

# cat nodename
# cat hostname.eri0
# cat hosts
# Internet host table
#       localhost     jack loghost     marcel
# hostname jack
# hostname

However, after I reboot the machine, I check hosts again. It will show:
# cat hosts
# Internet host table
#       localhost     unknown loghost     marcel
# hostname

Why? Do i miss anything? What is the reason of hostname changing back to unknown?
Question by:matchz
    LVL 34

    Expert Comment

    Use the system un-configuration command --> sys-unconfig

    See --> man sys-unconfig
    LVL 38

    Expert Comment


        For Solaris, there are 6 files need to be changed in order to change hostname.
    /etc/hostname.eri0   <-- interface

       And then reboot.

    LVL 2

    Expert Comment

    is there any case that you use DHCP for obtaining your network info (ip address, gateway, hostname etc) ?

    Author Comment

    Yes, I am using DHCP now.
    LVL 5

    Expert Comment

    You are assigning a static address while using DHCP.

    Please check the actual IP.
    Since you want a static IP, do not configure your machine for DHCP.

    Most likey, your machine figures out it's name is Jack and then realizes
    according to /etc/hosts this is some other machine. So it has to switch
    to unknown.
    LVL 38

    Accepted Solution


        If you use DHCP, then take out the following line from /etc/hosts     jack loghost   (X)

      and change the following line       localhost ------>       localhost jack loghost

        Otherwise, use static IP address.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now