/etc/resolv.confcontains a nameserver that is alive (as reported by the
nslookupis able to resolve
$ host google.com google.com has address 188.8.131.52 google.com has address 184.108.40.206 ... $ nslookup google.com ... Non-authorative answer: Name: google.com Address: 220.127.116.11 Name: google.com Address: 18.104.22.168 ..
telnetis not able to resolve
$ ping google.com ping: unknown host google.com $ telnet google.com google.com: node name or service name not known
telnet were unable to resolve hostnames, because they were not querying the configured DNS server (
nslookup seem to be using different DNS querying code), the solution is to:
cp /etc/nsswitch.dns /etc/nsswitch.conf
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
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
Anyway, lets say you are on Solaris 10 or older:
/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 hosts google.com
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.
root@solaris:~# svccfg -s name-service/switch svc:/system/name-service/switch> setprop config/host = "files dns" svc:/system/name-service/switch> listprop config config application config/default astring files config/value_authorization astring solaris.smf.value.name-service.switch config/printer astring "user files" config/host astring "files dns" svc:/system/name-service/switch> exit root@solaris11:~# svcadm refresh name-service/switch