Friday, February 23, 2024

Find DNS server IP from command line

Here are the command line / commands you can use to retrieve the active DNS server IP addresses on any Mac.

Launch the Terminal (Command-space for Spotlight, then type in Terminal). Type or paste in the following command:

Mac OS X 10.7 Lion:

networksetup -getdnsservers Wi-Fi

Mac OS X 10.6 Snow Leopard and before:

networksetup -getdnsservers airport

Note that until OS X Lion Apple referred to the Wi-fi as “Airport”. It was the Apple branded wi-fi. Since 10.7 they have changed tact and are now using the industry standard term “Wi-Fi”. In the above examples I have referred to the wireless connection because that’s what most of us use to connect to the Internet. However, if you wish to find the DNS assigned to the Ethernet (wired) connection, simply replace “airport” or “Wi-Fi” with “Ethernet”.

Assuming there are several DNS servers set within Mac OS X’s networking preferences, you will see a report of each DNS server in the order of their priority, looking something like this:

In the above example, the first two DNS IPs are for OpenDNS. The third one is the local ADSL modem/router.

What’s the fastest DNS server for you?

There is a great application called NameBench that will tell you the fastest DNS server from your network location. You can learn about it and download it from here (it is free).

Recent Articles


Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox