Changing hostname in Solaris

I had to change the host name 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

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

  2. thank you for your blog from all solaris admins =)

Speak Your Mind

*