Solaris 11 Changes: Managing Name Services (formerly known as /etc/resolv.conf)

Solaris 11 Changes: Managing Name Services (formerly known as /etc/resolv.conf)

Oracle Solaris 11 is leaving the SVR4 file based system administration of Solaris 10 behind. It uses SMF to manage the configuration state of many services.

The /etc/nsswitch.conf configuration file became a read only file which reflects the current state of the SMF service. Changes in the name resolution now require the following thress steps

 

  • Script the name vlaue pairs to be changed (strongly recommended)
  • update the SMF properties with the command svccfg
  • restart the name-service with the command svcadm

This can be done with a script like the one below:

#!/bin/ksh -p

me=${0##*/}

tmpfile=$(/usr/bin/mktemp -t ${me}.XXXXXX)

cat > $tmpfile <<EOF
setprop config/password = astring: ("files ldap")
setprop config/group = astring: ("files ldap")
setprop config/host = astring: ("files dns")
setprop config/network = astring: files
setprop config/protocol = astring: files
setprop config/rpc = astring: files
setprop config/ether = astring: files
setprop config/netmask = astring: files
setprop config/bootparam = astring: files
setprop config/publickey = astring: files
setprop config/netgroup = astring: ldap
setprop config/automount = astring: ("files ldap")
setprop config/alias = astring: files
setprop config/service = astring: files
setprop config/printer = astring: ("user files ldap")
setprop config/project = astring: files
setprop config/auth_attr = astring: files
setprop config/prof_attr = astring: files
setprop config/tnrhtp = astring: files
setprop config/tnrhdb = astring: files
exit
EOF

svccfg -s svc:/system/name-service/switch -f $tmpfile || exit
rm $tmpfile
svcadm refresh svc:/system/name-service/switch:default

Will Fiveash from Oracle published this script in his blog.

 

Stefan Schneider Wed, 03/14/2012 - 08:51