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

by nixcraft on January 28, 2005 · 11 comments

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:

search nixcraft.in
nameserver 202.54.1.30
nameserver 202.54.1.18

Where,

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

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 nixcraft.in
OR
# /usr/sfw/sbin/nslookup nixcraft.in
Output:

Server:  gwbsd2vsnl.nixcraft.in
Address:  192.168.1.202
Non-authoritative answer:
Name:    nixcraft.in
Address:  202.71.128.225

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 11 comments… read them below or add one }

1 Anonymous March 11, 2005

This works! GREAT! THANKS!

Reply

2 Anonymous April 10, 2005

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

Reply

3 Anonymous April 11, 2005

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

Reply

4 Charanjit Singh Cheema April 7, 2009

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

Reply

5 Steve May 9, 2009

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 foo.com, how do I prevent my resolver from first trying to resolve foo.com.mydomain.ARPA?

Reply

6 Brian August 5, 2009

Still having problems with SRV DNS queries.

Reply

7 pawan September 13, 2010

This works !!! excellent

Reply

8 fadzli jaafar October 6, 2010

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

Reply

9 Mustafa Gökhan Kurt January 27, 2011

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

Reply

10 Johann May 30, 2011

It works … thanks …

Reply

11 Rahul Singh June 5, 2011

Awesome. Fixed my Settings.
Thanks a lot!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 11 + 7 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: