How to add a nameserver to Solaris 11?

3

I'm having a name resolution problem in Solaris 11. According to the online Solaris guide, Chapter 12 Setting Up DNS Clients:

Client Set Up

Setting up DNS on a client machine involves two tasks:

    Creating the /etc/resolv.conf file, as described in"Creating the resolv.conf File".

    Modifying the /etc/nsswitch.conf file, as described in "Enabling a Machine to Use DNS".

    ...

However, when I open the file to make the change:

#                                                                               
# _AUTOGENERATED_FROM_SMF_V1_                                                   
#                                                                               
# WARNING: THIS FILE GENERATED FROM SMF DATA.                                   
#   DO NOT EDIT THIS FILE.  EDITS WILL BE LOST.                                 
# See resolv.conf(4) for details.                                               

domain  home.pvt

So, the manual tells me to create and modify resolv.conf, but resolv.conf tells me not to modify it. When I attempt to modify it with svccfg, the settings are not used.

How to add a nameserver to Solaris 11?


$ sudo cat /etc/nsswitch.conf

#
# _AUTOGENERATED_FROM_SMF_V1_
#
# WARNING: THIS FILE GENERATED FROM SMF DATA.
#   DO NOT EDIT THIS FILE.  EDITS WILL BE LOST.
# See nsswitch.conf(4) for details.

hosts:  files dns mdns
ipnodes:        files dns mdns
networks:       files
protocols:      files
rpc:    files
ethers: files
...

And trying the svcconfig tool:

$ sudo su -
Oracle Corporation      SunOS 5.11      11.3    September 2015
#  svccfg -s network/dns/client
svc:/network/dns/client> setprop config/nameserver = net_address: (172.16.1.1)
svc:/network/dns/client> exit

# ping www.google.com
ping: getaddrinfo: temporary name resolution failure
ping: unknown host www.google.com

Another try with OpenDNS and Google:

svc:/network/dns/client> setprop config/nameserver = net_address: (208.67.222.222 208.67.220.220 8.8.8.8)
exit

# ping www.google.com
ping: getaddrinfo: temporary name resolution failure
ping: unknown host www.google.com

# cat /etc/resolv.conf 
...

domain  home.pvt

jww

Posted 2016-07-16T21:15:48.820

Reputation: 1

How does your system get its IP address(es)? – Andrew Henle – 2016-07-18T10:03:53.197

Answers

0

The link you've found is for Solaris 10, not Solaris 11.

In Solaris 11 some configuration has changed to be SMF based rather than file based. This is true for DNS configuration. This means the way to change such information is by changing some SMF property followed by refreshing/restarting the appropriate service. The legacy config files, e.g. /etc/nsswitch.conf still exist but you are not supposed to touch them.

In your case what you are forgetting is the refresh/restart after you've changed the SMF properties:

$ svcadm refresh dns/client
$ svcadm restart dns/client

More info here.

Peter Hansson

Posted 2016-07-16T21:15:48.820

Reputation: 53

0

The preferred method is to interface with SMF, but you can always cheat...

Populate /etc/resolv.conf & nsswitch & then import into SMF:

nscfg import -fv dns/client

nscfg import -f name-service/switch

And verify that the DNS client service is enabled and online: svcs -xv dns/client

sleepyweasel

Posted 2016-07-16T21:15:48.820

Reputation: 101