High Sierra & Server.app DNS Service

##The Task:

Attempting to configure Server.app as a central DNS for my home network.


##Some details:

I. DHCP is provided by my router.

II. I do not want Server.app providing DHCP to clients.

III. Only certain clients should point to the Server.app DNS service address (for example 10.0.0.108, and will be manually configured on the client end.)


##Additional features:

I. I'm attempting to block ads from the Server.app DNS service.


##What has worked:

I. Blocking ads via custom /etc/hosts file.

<GitHub - StevenBlack/hosts: Extending and consolidating hosts files from several well-curated sources like adaway.org, m…>

II. Ads are blocked when browsing from Safari on the Server.app host.


##What does not work:

I. Blocking ads for hosts pointed at the Server.app DNS service.


What DNS sever is Server.app using? Is it some form of BIND9? Or something entirely different?


Appreciate any responses in advance.

Mac mini Server (Mid 2011), OS X Server, null

Posted on Oct 29, 2017 5:50 PM

Reply
1 reply

Oct 30, 2017 12:21 AM in response to Chilz0r

Yep, it's BIND 9. I think it's 9.9.7 on 10.12, dunno for 10.13.


Your problem here is that /etc/hosts is a way of brute-forcing DNS for the local computer only; nothing in that file gets used by Server.app. So when Safari on the server needs a domain, it gets it first from /etc/hosts, and then goes to Server.app's DNS server (assuming the server is pointed to itself for DNS service). Other Macs on the network will look at their *own* /etc/hosts files, then at Server.app, but never at the /etc/hosts on your server.


So if you *really* want to block this in DNS, here's what you do: the rest of the Macs on your network can *only* get their DNS from your server. If they have multiple DNS servers in System Preferences, that's not a rank order, that's a round robin: sometimes they use your server, sometimes they'll go to Google DNS or whomever.


Your server, meanwhile, *does* point to other servers for any domain for which it's not authoritative. So your iMac might ask your server, "hey, where's google.com?" And your Mac Pro checks its own tables and says, "I don't know that, so I'm going to look it up elsewhere."


The secret sauce: you can make your server *think* it knows any given domain, just put it into your DNS tables. That will instantly blackhole those domains; put google.com into your own DNS, and your server stops looking for the real Google and just hands out whatever IP addresses you've manually entered. This (deliberately) breaks every computer looking at the server for DNS—those domains effectively no longer exist—but it doesn't break anyone else on the Internet, because no one else is talking to your DNS server.


But here's the thing: why do all this? You can much more easily set up ad blockers in all of your browsers, which have the added benefit that someone else does the job of constantly updating the block tables. Plus, browser plug-ins fail gracefully when they don't retrieve an ad. Your method is going to leave big honking whitespaces on every page with flashing question marks, or whatever now gets shown when servers are missing. If the page is written such that the Javascript waits for the ads to load before it shows any actual page content (not uncommon), you'll never see anything on the page as it'll be waiting forever.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

High Sierra & Server.app DNS Service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.