In Mac OS X, how do I check what DNS server I'm currently using (preferably a command line solution)?
System Preferences > Network shows
192.168.1.1, which is my router's address and not the real DNS server.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Use the following command to view your DNS server in Mac OS X :
Open the terminal and type
$ cat /etc/resolv.conf
to view your DNS server.
Sample output :
$ cat /etc/resolv.conf domain http://www.example.com (Here, you can see DNS records info of the particular domain name.) nameserver 22.214.171.124 nameserver 126.96.36.199
Akamai provides a DNS debugging tool which returns the IP address of the resolver used for the query. Open Terminal.app and run the following command:
dig whoami.akamai.net +short
UltraDNS also provides one, but I've found it to be less reliable:
dig whoami.ultradns.net +short
dnsleaktest.com provides the same results via a web interface.
The IP address returned by these tools is a DNS resolver in use for your network, but may be only one of several.
You can benchmark the performance of your local and alternate DNS servers using namebench.
I reached to this question while I was looking for a way to get the list of DNS servers of a specific network adapter in text format (for example the Wi-Fi adapter):
This DNS servers list can be obtained in the terminal with this command:
$ networksetup -getdnsservers Wi-Fi 188.8.131.52 184.108.40.206 220.127.116.11 18.104.22.168 192.168.1.1
And for Ethernet adapter:
$ networksetup -getdnsservers Ethernet 22.214.171.124 126.96.36.199 188.8.131.52 184.108.40.206 192.168.1.1