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.
6 Answers
You could try issuing the following at the command line:
scutil --dns | grep 'nameserver\[[0-9]*\]'It should give you a list of DNS servers configured on your system.
5Use the following command to view your DNS server in Mac OS X :
Open the terminal and type
$ cat /etc/resolv.confto view your DNS server.
Sample output :
$ cat /etc/resolv.conf
domain (Here, you can see DNS records info of the particular domain name.)
nameserver 68.87.85.98
nameserver 68.87.69.146 3 Your router is acting as a DNS forwarder, you ask your router and your router asks a DNS server for you. You need to login to your router web config to figure out what it's using, or you could just enter it directly into your Network configuration.
3Akamai 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 +shortUltraDNS also provides one, but I've found it to be less reliable:
dig whoami.ultradns.net +shortThe IP address returned by these tools is a DNS resolver in use for your network, but may be only one of several. There might be an advantage to using the IP in your Network preferences directly.
You can benchmark the performance of your local and alternate DNS servers using namebench.
2I 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
8.8.8.8
4.2.2.4
4.2.2.1
4.2.2.2
192.168.1.1And for Ethernet adapter:
$ networksetup -getdnsservers Ethernet
8.8.8.8
4.2.2.4
4.2.2.1
4.2.2.2
192.168.1.1 That is the DNS server your mac is using. Your router is running a caching DNS server, and setting itself as the DNS server via DHCP. If you login to your router, you might be able to find out which DNS servers it uses.