Linux menu

Saturday, September 20, 2014

How to change hostname in Solaris 11

Here is the step by step procedure to change/rename hostname on Solaris 11. In Solaris 10 all we know that we need to edit few files in order to change the hostname, but in Solaris 11 we need to change the hostname in SMF service level. Let we can start doing that.


Checking the SMF Services
root@unixrock_SOL11:~# svcs -a|grep -i node
online         21:53:28 svc:/system/identity:node
root@unixrock_SOL11:~#
Checking the current property settings
root@unixrock_SOL11:~# svccfg -s system/identity:node
svc:/system/identity:node> listprop config
config                       application
config/enable_mapping       boolean     true
config/ignore_dhcp_hostname boolean     true
config/nodename             astring     unixrock_SOL11
config/loopback             astring     unixrock_SOL11
svc:/system/identity:node>
Change/Rename the hostname entries
root@unixrock_SOL11:~# svccfg -s system/identity:node
svc:/system/identity:node>
svc:/system/identity:node> setprop config/nodename=unixrocks11
svc:/system/identity:node> setprop config/loopback=unixrocks11
svc:/system/identity:node>
Verifying the changes
root@unixrock_SOL11:~# svccfg -s system/identity:node
svc:/system/identity:node> listprop config
config                       application
config/enable_mapping       boolean     true
config/ignore_dhcp_hostname boolean     true
config/nodename             astring     unixrocks11
config/loopback             astring     unixrocks11
svc:/system/identity:node>
Restart the service to take effect the changes
root@unixrock_SOL11:~# svccfg -s system/identity:node refresh
root@unixrock_SOL11:~# svcadm restart system/identity:node
root@unixrock_SOL11:~# svccfg -s system/identity:node listprop config
config                       application
config/enable_mapping       boolean     true
config/ignore_dhcp_hostname boolean     true
config/nodename             astring     unixrocks11
config/loopback             astring     unixrocks11
root@unixrock_SOL11:~# hostname
unixrocks11
root@unixrock_SOL11:~#
Cool and simple way to do the hostname changes in Solaris 11. You can see the changes while opening new session.

No comments: