Configure DNS services in Solaris 11 using SMF

With the introduction of Solaris 11, a lot of configuration has been moved from configuration files into the SMF. This is also true for the resolv.conf and nsswitch.conf used by DNS services.

View existing DNS client configuration

# svccfg -s network/dns/client listprop config
config                     application
config/value_authorization astring     solaris.smf.value.name-service.dns.client
config/domain              astring     gb.example.com
config/nameserver          net_address 10.0.2.1

Defining DNS settings (resolv.conf)

DNS Name Servers

Update the SMF repository with a single DNS name server. Lets use 10.0.1.1 as our example:

# svccfg -s network/dns/client setprop config/nameserver = net_address: 10.0.1.1

If we have multiple name servers, we specify all on the command-line. For example 8.8.8.8 and 8.8.4.4 for the primary and secondary DNS servers.

# svccfg -s network/dns/client setprop config/nameserver = net_address: "8.8.8.8 8.8.4.4"

Set domainname

In this example, we are setting the domainname to example.com:

# svccfg -s network/dns/client setprop config/domain = astring: example.com

Add/Change the search domains

For this example, we are including eu.example.com and us.example.com.:

# svccfg -s network/dns/client setprop config/search = astring: "eu.example.com us.example.com"

Name Resolution order

Here we are defining our name resolution order to lookup local files and then DNS entries:

# svccfg -s name-service/switch setprop config/ipnodes = astring: "files dns"
# svccfg -s name-service/switch setprop config/host = astring: "files dns"

Update legacy files

The following commands will build an /etc/resolv.conf and /etc/nsswitch.conf based on your settings above:

# svcadm enable dns/client
# nscfg export svc:/network/dns/client:default
# svcadm refresh name-service/switch