Changing hostname in Solaris

May 20, 2009 · Filed Under General Solaris topics 

I had to change the hostname in one of Solaris zones today, and just out of curiousity looked into /etc/init.d/network script. That’s how I learned a new (to me) option of the uname command, which seems to be specific to Solaris: uname -S <newhostname>.

So here’s a very simple procedure for updating the hostname of your Solaris 10 server.

Step 1: Update /etc/hosts

Quite simply, you need to add an IP to hostname association for in here, for the new hostname you plan to use. In this example, I’ll use a “newsolaris” hostname.

192.168.0.6 newsolaris

Step 2: Change /etc/nodename

Just overwrite the previous value in this file (or make a backup copy of /etc/nodename to make possible going back to old hostname a bit easier):

echo "newsolaris" > /etc/nodename

Step 3: Update /etc/hostname.<primary interface>

This is a step more important for physical Solaris servers rather than for Solaris zones:

echo "newsolaris" > /etc/hostname.e1000g0

Step 4: Reconfigure network and reset hostname to the new value

/etc/init.d/network stop
/etc/init.d/network start

or, as it was in my case, if you don’t want to refresh network config and just need to apply the new hostname, do it manually:

uname -S newsolaris

See also:

Comments

2 Responses to “Changing hostname in Solaris”

  1. Teemon on October 2nd, 2009 12:26 pm

    Я уж подумал навсегда поменяет, но:
    This change does not persist across reboots of the system © man

  2. solarisadmin on January 9th, 2010 11:30 am

    thank you for your blog from all solaris admins =)

Leave a Reply