Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am having a very strange problem with my installation of Solaris 11. DNS resolution just won't work, but strangely enough, nslookup does and connectivity is fine:

root@solarisxyz:~# ping stackexchange.com
ping: unknown host stackexchange.com
root@solarisxyz:~# nslookup stackexchange.com
Server:         10.x.x.x (DNS)
Address:        10.x.x.x#y

Non-authoritative answer:
Name:   stackexchange.com
Address: 64.34.119.12

root@solarisxyz:~# ping 64.34.119.12
64.34.119.12 is alive

Relevant sections of files:

  • /etc/resolv.conf: (this is the same thing our Linux boxes have)

    domain us.oracle.com
    nameserver 10.x.x.x
    nameserver 10.x.x.x  
    
  • /etc/hosts:

    # ::1 solarisxyz localhost (commented out)
    127.0.0.1 localhost loghost solarisxyz
    
  • /etc/nsswitch.conf:

    hosts:    files dns
    # pretty much everything else set to files
    
share|improve this question
    
In resolv.conf, is it actually 10.x.x.x or did you hide the IP address? –  amphetamachine Nov 19 '11 at 4:19
    
@amphetamachine The actual address is correct and reachable via ping. –  NullUser Nov 19 '11 at 4:20
1  
Could you please compare the output of these commands: dig @10.x.x.x stackexchange.com dig @8.8.8.8 stackexchange.com dig stackexchange.com –  amphetamachine Nov 19 '11 at 21:06
add comment

5 Answers

up vote 6 down vote accepted

Network configuration has radically changed starting with Solaris 11. nsswitch.conf is only informative now. Assuming you are not in automatic mode, in which case DNS would have been correctly configured, here is the new procedure:

http://docs.oracle.com/cd/E23824_01/html/E24456/gliyc.html#OSTELgllcu

share|improve this answer
    
So basically editing files like nsswitch.conf has no effect whatsoever on network configuration now? –  NullUser Nov 21 '11 at 21:56
    
Indeed, nsswitch.conf is now managed by smf just like resolv.conf and many other /etc configuration files. You should refer to their manual pages for more information. –  jlliagre Nov 21 '11 at 22:17
add comment

First please start truss on nscd:

truss -aefld -vall -wall -rall -o truss-nscd.out -u nss_\*:: -u libnsl:: -p `pgrep nscd`

While the above truss command is running, please try

truss -aefld -vall -wall -rall -o truss-getent_1.out -u a.out,libnsl:: getent hosts ANY_HOSTNAME

Then please temporarily disable nscd:

svcadm disable name-service-cache

and run:

truss -aefld -vall -wall -rall -o truss-getent_2.out -u a.out,libnsl:: -u nss_\*:: getent hosts ANY_HOSTNAME

Now you may re-enable name-service-cache:

svcadm enable name-service-cache

Now try ...hope it will works.

share|improve this answer
add comment

For Solaris 10, I did svcadm restart /system/name-service-cache; then, I can resolve host using telnet/ping.

share|improve this answer
add comment

I think your problem has something to do with the Solaris Name Service daemon or more correctly the configuration of this beast. Perhaps you have edited /etc/nsswitch.conf by hand? This would explain why the Name Service daemon does not pick up upon it.

The nslookup command does not - afaik - use the Solaris Name Service. This might explain why you see nslookup working as you expect while everything else is not.

On Solaris it is always a good idea to verify if the lookup services are working as you expect by using the getent command. In your example it would be:

getent hosts stackexchange.com

So the question is how to make sure the Solaris Name Service knows that it has to lookup host names in both local files as well as in DNS. Remember that in Solaris 11 you are no longer supposed to / allowed to edit files such files as /etc/nsswitch.conf directly. They are controlled by daemons that run under SMF. Here is how to change it:

# svccfg
svc:> select name-service/switch
svc:/system/name-service/switch> setprop config/host = astring: "files dns"
svc:/system/name-service/switch> select system/name-service/switch:default
svc:/system/name-service/switch:default> refresh
svc:/system/name-service/switch:default> validate
svc:/system/name-service/switch:default> exit
# svcadm refresh name-service/switch

After this you will notice that your /etc/nsswitch.conf file has been re-written to disk. If you have previously edited by hand you may not see any actual change. Re-issue the getent command and hopefully it works now.

Good luck.

share|improve this answer
add comment

Configuring Naming Services by Using SMF

The following example shows how to configure DNS by using SMF commands.

# svccfg
svc:> select dns/client
svc:/network/dns/client> setprop config/search = astring: \
("us.company.com" "eu.company.com" "companya.com" "companyb.com" "company.com" )
svc:/network/dns/client> setprop config/nameserver = net_address: \
( 138.2.202.15 138.2.202.25 )
svc:/network/dns/client> select dns/client:default
svc:/network/dns/client:default> refresh
svc:/network/dns/client:default> validate
svc:/network/dns/client:default> select name-service/switch
svc:/system/name-service/switch> setprop config/host = astring: "files dns"
svc:/system/name-service/switch> select system/name-service/switch:default
svc:/system/name-service/switch:default> refresh
svc:/system/name-service/switch:default> validate
svc:/system/name-service/switch:default> 
# svcadm enable dns/client
# svcadm refresh name-service/switch
# grep host /etc/nsswitch.conf
hosts:  files dns
# cat /etc/resolv.conf
share|improve this answer
add comment

Your Answer

 
discard

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.