Solaris UNIX: How to Setup DNS Client configuration / name server

by on January 28, 2005 · 15 comments· LAST UPDATED October 8, 2007

in , ,

So how do you set DNS namserver under Sun Solaris UNIX system? The resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information.

Internet address (in dot notation) of a name server that the resolver should query. Up to MAXNS (currently 3, see ) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. To configure Solaris nameserver edit or modify /etc/resolv.conf file.

DNS Client Setup

First Create the file called /etc/resolv.conf - which includes the primary and secondary DNS server IP address for Solaris system, it can be your own DNS server or your ISPs DNS server:
# touch /etc/resolv.conf

Open /etc/resolv.conf using vi text editor:
# vi /etc/resolv.conf
Add the following lines to it:



  • nameserver IP : It is IP of first DNS server
  • search : Default domain name to search. For example, if you type command nslookup www, it will search it as

2) Enable the name resolving using DNS as follows:
# cp /etc/nsswitch.dns /etc/nsswitch.conf
3) Test new name server by running the nslookup command as follows:
# nslookup
# /usr/sfw/sbin/nslookup

Non-authoritative answer:
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 15 comments… read them below or add one }

1 Anonymous March 11, 2005 at 5:36 am

This works! GREAT! THANKS!


2 Anonymous April 10, 2005 at 7:21 pm

It really works. Never did a Solaris configuration yet, well ’till now.


3 Anonymous April 11, 2005 at 2:13 pm

Might be because of

1) Your solaris system is using DHCP to get all info such as IP, Router, DNS server etc
2) You configured DNS while installing Solaris itself
3) OR may be you have configured NIS+ Client to Use DNS


4 Charanjit Singh Cheema April 7, 2009 at 5:41 pm

Thanks my solaries server is able to connect with my linux dns server!!! Thanks once again.


5 Steve May 9, 2009 at 9:24 am

How do you prevent the resolver from appending your domain name to the end of a query?

For example, if my domain name is mydomain.ARPA and I do a lookup for, how do I prevent my resolver from first trying to resolve


6 Brian August 5, 2009 at 5:53 pm

Still having problems with SRV DNS queries.


7 pawan September 13, 2010 at 12:56 pm

This works !!! excellent


8 fadzli jaafar October 6, 2010 at 4:07 am

yeah!!!it working for sun solaris…thank you…


9 Mustafa Gökhan Kurt January 27, 2011 at 2:17 pm

its done. thanks for sharing.
#cp /etc/nsswitch.dns /etc/nsswitch.conf and than #init 6


10 Johann May 30, 2011 at 6:48 am

It works … thanks …


11 Rahul Singh June 5, 2011 at 3:46 am

Awesome. Fixed my Settings.
Thanks a lot!


12 wakil hasan July 4, 2011 at 12:03 pm

hi many many thx…
its working instantly
your website is one of the best. for linux how to i always turn here


13 Marcelo August 20, 2012 at 2:04 am

Work fine.

Thanks a loot.


14 Petey D August 6, 2013 at 2:21 pm

Thanks! Works great!


15 khyap December 16, 2014 at 11:03 am

Is there no way to specify DNS IP during OS installation itself e.g. I can do this very easily for windows and many other linux distros

Weird enough if I choose DHCP and let it auto capture from router, after installation finish the file /etc/resolv.conf will have got created and name resolution will work.

There is another portion on installation to setup ‘nameservers’. Options are NIS+,NIS,DNS,LDAP and none but that portion doesnt seem to be right


Leave a Comment

Tagged as: , , , , , , ,

Previous post:

Next post: