How to properly change the resolv.conf file in Solaris using SMF

If you are running the newer  versions of solaris you may be tempted to use the old ways where you edit the resolv.conf file to setup your DNS 

DO NOT DO THIS !

Oracle wants you to be using the SMF ( Service Management Facility ) to be making such changes instead using the following
svccfg -s dns/client setprop config/nameserver=net_address: x.x.x.x
svccfg -s dns/client setprop config/domain = astring: "myhost.org"
svccfg -s name-service/switch setprop config/host = astring: "files dns
svcadm refresh name-service/switch
svcadm refresh dns/client

Also ensure you do not have NCP enabled if you have NCP enabled even if you have statically assigned your IP and even if you use the above Svc commands NCP will overwrite them if an available DHCP server answers make sure NCP is not set to auto it should be default fixed. Unless of course you want to have your DNS configured via DHCP in which case you wont need the above. You can find out how NCP is configured by using #netadm list.

you can set NCP to default fixed by using this command
#netadm enable -p ncp DefaultFixed if you are using Automatic your network connection will go down! you will need to setup all the network details again.

Make sure to refresh the DNS client for the changes to take place I personally like the SMF approach to editing the file
SMF validates the input to the svccfg commands if you make a typo in syntax it will be caught. Now if you make a typo in the dns ip
nothing will help you there.

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.