List DNS servers in Mavericks How to check which DNS server was used to resolve particular hostname within VPN network?

I am using company-provided proprietary VPN client and want to see DNS server's IP address, but 

networksetup -getdnsservers &lt;service name&gt;


does not list any DNS servers at all. However, I can ping any server in internal network, so DNS is apparently working.

How does DNS lookup work on OSX with/without VPN connections?
in OSX Mavericks (10.9 - actually 10.6.3 up, I believe) if you want to see the active DNS configuration:

scutil --dns


The -first- entry (resolver #1) is reportedly the active configuration...though I've seen plenty of cases where that's not the case.

from man scutil

 The --dns option reports the current DNS configuration.  The first listed
 resolver(5) configuration is considered to be the "default" configura-
 tion.  Additional "supplemental" configurations follow.  Those containing
 a "domain" name will be used for queries matching the specified domain.
 Those without will be used as a "default" configuration in addition to
 the first listed.


IME, if what you see here doesn't match what you expect (ie, network > advanced > dns), you may need to disable/enable the appropriate network adaptor for it to refresh...

Other tips in recent OSX:  

With 10.7 or 10.8, search domains dont apply to lookups with a dot in them.  ie - www.test won't append search domains at all, where www will.   there's a fix:

sudo vim /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
Add &lt;string&gt;-AlwaysAppendSearchDomains&lt;/string&gt;after line 16
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/sbin/mDNSResponder&lt;/string&gt;
        &lt;string&gt;-launchd&lt;/string&gt;
        &lt;string&gt;-AlwaysAppendSearchDomains&lt;/string&gt;
    &lt;/array&gt;


Now unload and reload the mDNSResponder service:
   sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
   sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

the network > advanced > dns config is -PER INTERFACE-.   So if you use wireless and wired...you have to setup both.

there's another way, too - /etc/resolver  - one example in here: Do /etc/resolver/ files work in Mountain Lion for DNS resolution? and more here: https://www.dforge.net/2013/01/30/osx-domain-specific-dns-servers-etcresolver/

As for trying to do an nslookup - it's well known that nslookup (and host and dig) doesn't follow the (extremely unique and mixed up) OSX resolution mechanism.  Use ping.