

There are tons of ways to find things in macOS. usr/sbin/ipconfig getpacket en0 2> /dev/null | grep name_ | cut -d' ' -f3. If you login to your router, you might be able to find out which DNS servers it uses. Your router is running a caching DNS server, and setting itself as the DNS server via DHCP. Thanks to the lovely Allister we also have ipconfig to add to the list: That is the DNS server your mac is using. Scutil -dns | grep nameserver | awk '' ipconfig this method works for any operating system like Windows, Linux or Mac: XX.XX.XX. We can also simplify the output to just the servers with awk: This name servers will show you the result of the dns propagation test.

Here, we use the –dns option, which outputs a lot of DNS stuffs, including all the built-in resolvers: The next way we’ll grab DNS information is using scutil. The easiest way to see theses to simply cat it and grep for nameserver:Ĭat /etc/nf | grep nameserver scutil The /etc/nf file is updated automatically to look at what servers are used to resolve names used for DNS. Select the first connection in your list and click Advanced. Some of this might seem more complicated than it should be. So when you’re running a script you might choose to grab DNS information one way or another, according to what you’re after. There are a number of ways to grab what DNS server a device is using in macOS. For example, something as simple as what hosts you use to resolve names on a Mac. One of my favorite things about grabbing things with scripts is just how many ways (and sometimes how needfully or needlessly convoluted you can make them) to grab the same pieces of information.
