{"id":1044,"date":"2022-02-05T18:25:00","date_gmt":"2022-02-05T23:25:00","guid":{"rendered":"https:\/\/sunapi386.ca\/wordpress\/?p=1044"},"modified":"2023-02-06T19:48:59","modified_gmt":"2023-02-07T00:48:59","slug":"domain-specific-dns-server-on-macos","status":"publish","type":"post","link":"https:\/\/sunapi386.ca\/wordpress\/domain-specific-dns-server-on-macos\/","title":{"rendered":"Domain-specific DNS server on MacOS"},"content":{"rendered":"\n<p><br>Check out your DNS configuration using&nbsp;<code>$ scutil --dns<\/code>&nbsp;. Resolver #1 is what is handling my DNS lookups, #2 handles the&nbsp;<code>.local<\/code>&nbsp;domain. Resolver #3 is the reverse lookup for the&nbsp;<code>169.254<\/code>&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/whatis.techtarget.com\/definition\/Automatic-Private-IP-Addressing-APIPA\" target=\"_blank\">APIPA address space<\/a>, and so on. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jason@jmbp15-ati ~&gt; scutil --dns                                                                                                                                                                                                          18:10:04\nDNS configuration\n\nresolver #1\n  search domain&#91;0] : home\n  nameserver&#91;0] : 8.8.8.8\n  flags    : Request A records\n  reach    : 0x00000002 (Reachable)\n\nresolver #2\n  domain   : local\n  options  : mdns\n  timeout  : 5\n  flags    : Request A records\n  reach    : 0x00000000 (Not Reachable)\n  order    : 300000\n\nresolver #3\n  domain   : 254.169.in-addr.arpa\n  options  : mdns\n  timeout  : 5\n  flags    : Request A records\n  reach    : 0x00000000 (Not Reachable)\n  order    : 300200\n\n&#91;...]\nresolver #8\n  domain   : ds\n  nameserver&#91;0] : 10.7.0.1\n  flags    : Request A records\n  reach    : 0x00000002 (Reachable)\n\nDNS configuration (for scoped queries)\n\nresolver #1\n  search domain&#91;0] : home\n  nameserver&#91;0] : 8.8.8.8\n  if_index : 4 (en0)\n  flags    : Scoped, Request A records\n  reach    : 0x00000002 (Reachable)\n<\/code><\/pre>\n\n\n\n<p>Resolver #8 is what I have added to resolve a custom TLD &#8220;ds&#8221;.<\/p>\n\n\n\n<p id=\"2170\">To add an additional resolver to a Mac, create a directory at&nbsp;<code>\/etc\/resolver<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mkdir \/etc\/resolver<\/pre>\n\n\n\n<p id=\"deb6\">For each domain that you want to hit a specific nameserver, create a file with the name of your desired domain and a&nbsp;<code>nameserver<\/code>&nbsp;line (or lines) in the file. For my internal domain I used the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo '10.7.0.1' &gt; \/etc\/resolver\/ds<\/pre>\n\n\n\n<p id=\"e494\">Now, when I run&nbsp;<code>scutil --dns<\/code>&nbsp;again I see my newly created resolver:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">resolver #8\n  domain   : ds\n  nameserver[0] : 10.7.0.1\n  flags    : Request A records\n  reach    : 0x00000002 (Reachable)<\/pre>\n\n\n\n<p>Note; 10.7.0.1 needs to be a DNS resolver.<\/p>\n\n\n\n<p id=\"f502\">A quick lookup confirms that my configuration is doing what I want it to do. Another thing I discovered when looking into this is that&nbsp;<code>dig<\/code>&nbsp;and&nbsp;<code>nslookup<\/code>&nbsp;on OSX&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/stackoverflow.com\/questions\/50914268\/os-x-etc-resolver-dev-isnt-working-why-not\" target=\"_blank\">don\u2019t use the OS resolver configuration<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ dscacheutil -q host -a name sanfran.ds\nname: sanfran.ds\nip_address: 10.7.0.100<\/pre>\n\n\n\n<p id=\"8d0f\">And that\u2019s it. If I want to configure forward or reverse zones to resolving using a specific nameserver on OSX it\u2019s that simple.<\/p>\n\n\n\n<p><a href=\"https:\/\/medium.com\/tag\/dns?source=post_page-----7c704dbaff59---------------dns-----------------\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Check out your DNS configuration using&nbsp;$ scutil &#8211;dns&nbsp;. Resolver #1 is what is handling my DNS lookups, #2 handles the&nbsp;.local&nbsp;domain. Resolver #3 is the reverse lookup for the&nbsp;169.254&nbsp;APIPA address space, and so on. Resolver #8 is what I have added to resolve a custom TLD &#8220;ds&#8221;. To add an additional resolver to a Mac, create &hellip; <a href=\"https:\/\/sunapi386.ca\/wordpress\/domain-specific-dns-server-on-macos\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Domain-specific DNS server on MacOS<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1044","post","type-post","status-publish","format-standard","hentry","category-thoughts"],"_links":{"self":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=1044"}],"version-history":[{"count":2,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1044\/revisions"}],"predecessor-version":[{"id":1050,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1044\/revisions\/1050"}],"wp:attachment":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=1044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=1044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=1044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}