Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  • /etc/resolv.conf contains a nameserver that is alive (as reported by the ping command)
  • host or nslookup is able to resolve google.com

    $ host google.com
    google.com has address
    google.com has address
    $ nslookup google.com
    Non-authorative answer:
    Name:   google.com
    Name:   google.com
  • ping or telnet is not able to resolve google.com

    $ ping google.com
    ping: unknown host google.com
    $ telnet google.com
    google.com: node name or service name not known
share|improve this question

It seems ping and telnet were unable to resolve hostnames, because they were not querying the configured DNS server (host and nslookup seem to be using different DNS querying code), the solution is to:

Overwrite /etc/nsswitch.conf with /etc/nsswitch.dns:

cp /etc/nsswitch.dns /etc/nsswitch.conf
share|improve this answer
Ideally you should copy /etc/nsswitch.dns over to /etc/nsswitch.conf, this is the normal and documented way to set up your system to use DNS, among creating the /etc/resolv.conf – BitsOfNix Jun 10 '13 at 15:00
It also depends how you installed Solaris. If at the interactive installer, or in sysidcfg, you specify DNS, nsswitch.conf should already be configured properly. – James O'Gorman Jun 10 '13 at 15:54
@AlexandreAlves Thanks, I have updated the answer. – Adam Siemion Jun 10 '13 at 16:44
@JamesO'Gorman Since I have very little experience with Solaris, I admit that maybe I missed it during the installation. But still it is really surprising that this is not set by default. – Adam Siemion Jun 10 '13 at 16:48
@AdamSiemion keep in mind that many of Solaris' largest customers are closed environments where DNS may not necessarily be used, and instead NIS holds sway. (or LDAP sometimes). Sun used to focus most of it's energy on it's top 50 customers. DNS stuff was added for the rest of their customers, but not made the default, because revenue from the top 50 > the rest. Oracle likely plays a similar game. – Tim Kennedy Jun 11 '13 at 13:01

Adam, you do not tell us what version of Solaris you're using.

All host lookup on Solaris goes through the Solaris Naming Service daemon. The only exception is nslookup which does a direct DNS query against a DNS server. The Naming Service daemon basically acts as a cache of naming information. Other operating systems have similar services. The Solaris Naming Service is configured in the /etc/nsswitch.conf file.

I really, really hope you are on an older version, such as Solaris 10 or before. Otherwise you've now manually edited a file you are no longer supposed to edit : the /etc/nsswitch.conf file.

Anyway, lets say you are on Solaris 10 or older: Your /etc/nsswitch.conf should have an entry like this:

hosts:  files dns

This tells the Solaris Naming Service that hosts should be looked up first in the local file (i.e. /etc/hosts) and then in DNS. You can of course also only have "dns" here but people will normally want it so that /etc/hosts can override what is in DNS.

You may now have to restart the naming service daemon:

svcadm restart /system/name-service-cache

You can always verify your naming service setup with the Solaris getent command:

getent hosts google.com

The getent command verifies that the Solaris Naming Service works as you expect. You cannot use nslookup to verify this.

If your are on Solaris 11 then you can use nolan600's answer to this question. The getent command also applies to Solaris 11.

Hope you can use some of this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.