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

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.

ADVERTISEMENTS

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
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
16 comments… add one
  • Anonymous Mar 11, 2005 @ 5:36

    This works! GREAT! THANKS!

  • Anonymous Apr 10, 2005 @ 19:21

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

  • Anonymous Apr 11, 2005 @ 14:13

    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

  • Charanjit Singh Cheema Apr 7, 2009 @ 17:41

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

  • Steve May 9, 2009 @ 9:24

    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?

  • Brian Aug 5, 2009 @ 17:53

    Still having problems with SRV DNS queries.

  • pawan Sep 13, 2010 @ 12:56

    This works !!! excellent

  • fadzli jaafar Oct 6, 2010 @ 4:07

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

  • Mustafa Gökhan Kurt Jan 27, 2011 @ 14:17

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

  • Johann May 30, 2011 @ 6:48

    It works … thanks …

  • Rahul Singh Jun 5, 2011 @ 3:46

    Awesome. Fixed my Settings.
    Thanks a lot!

  • wakil hasan Jul 4, 2011 @ 12:03

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

  • Marcelo Aug 20, 2012 @ 2:04

    Work fine.

    Thanks a loot.

  • Petey D Aug 6, 2013 @ 14:21

    Thanks! Works great!

  • khyap Dec 16, 2014 @ 11:03

    Is there no way to specify DNS IP during OS installation itself e.g. 8.8.8.8? 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

  • Rushikesh Feb 26, 2016 @ 10:49

    Hello,
    I have a web server ( Solaris10) with IP 10.92.101.103 and I want to use same as DNS server also. Please help in this regards..

Leave a Reply

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

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.