Solaris 11: Change Hostname Using Svccfg

Solaris 11: Change Hostname Using Svccfg

When Solaris 11 was released more configurations were moved into the service management framework, and moved out of configuration files, one of these changes was the hostname/nodename.

View Hostname in SMF

This will read back the configuration out of the SMF.

# svccfg -s system/identity:node listprop config
config           application
config/nodename astring     solaris11box
config/loopback astring     solaris11box

Change Hostname in SMF

We have two separate settings, which need to be updated.

# svccfg -s system/identity:node setprop config/nodename = astring: newname
# svccfg -s system/identity:node setprop config/loopback = astring: newname

Review the Changes

# svccfg -s system/identity:node listprop config
config           application
config/nodename astring     newname
config/loopback astring     newname

Restart the Service to Reflect Changes

The system is now aware of the change, however it doesn’t use the change until the next reboot.  We can accelerate this by restarting the system/identity:node service.

# svccfg -s system/identity:node refresh
# svcadm restart system/identity:node

This will then show a system message reflecting the new hostname, to see the change in your shell prompt, you can spin off a child bash shell.  You can also use the hostname command to view the current hostname.

UPDATEDecember 30, 2012

Included an update based on Mark’s comment below to account for the refresh which needs to take place.

One thought on “Solaris 11: Change Hostname Using Svccfg

  1. Mark Meulemans

    First off, thanks for all your Solaris 11 posts! I just needed to configure my first Solaris 11 server ever and by going through your posts I’ve already managed to reconfigure the network and get a 4 port LACP trunk setup with a number of VLANs and IP addresses.

    Anyways, I wanted to point out a step that’s missing from here, which may be similar to changes in Solaris 11 versions when it comes to networking. Basically I found that the properties need to be refreshed before restarting the service, otherwise they won’t be fully reflected, specifically when it comes to logging back into the server and having the shell show the updated hostname.

    Additional command needed
    svccfg -s system/identity:node refresh


    Thanks again!