{"id":1095,"date":"2024-01-06T18:05:35","date_gmt":"2024-01-06T23:05:35","guid":{"rendered":"https:\/\/sunapi386.ca\/wordpress\/?p=1095"},"modified":"2024-01-06T18:05:35","modified_gmt":"2024-01-06T23:05:35","slug":"how-to-set-up-split-dns-configuration-on-macos-for-specific-domains","status":"publish","type":"post","link":"https:\/\/sunapi386.ca\/wordpress\/how-to-set-up-split-dns-configuration-on-macos-for-specific-domains\/","title":{"rendered":"How to Set Up Split DNS Configuration on macOS for Specific Domains"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p>For someone who needs to direct traffic for specific domains to a particular server, setting up a split DNS configuration on macOS is a straightforward way to achieve this. Today, we&#8217;ll explore how to resolve all domains ending in <code>.sf<\/code> through a designated DNS server at <code>172.16.7.1<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is Split DNS?<\/h3>\n\n\n\n<p>Split DNS is a configuration where DNS queries for specific domains are handled by a designated DNS server, while all other queries go through the default DNS settings. This setup is particularly useful in development environments or for internal network purposes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setting Up Split DNS on macOS<\/h3>\n\n\n\n<p>To set up a split DNS configuration on macOS, we&#8217;ll use the built-in <code>resolver<\/code> feature. Here\u2019s how:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Create a Resolver Directory<\/h4>\n\n\n\n<p>Open Terminal and create a directory for resolver if it doesn&#8217;t already exist:<\/p>\n\n\n\n<p>bashCopy code<\/p>\n\n\n\n<p><code>sudo mkdir -v \/etc\/resolver<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Create a Resolver File<\/h4>\n\n\n\n<p>In <code>\/etc\/resolver\/<\/code>, create a file named <code>sf<\/code>:<\/p>\n\n\n\n<p>bashCopy code<\/p>\n\n\n\n<p><code>sudo nano \/etc\/resolver\/sf<\/code><\/p>\n\n\n\n<p>Add the following line to specify the DNS server:Copy code<\/p>\n\n\n\n<p><code>nameserver 172.16.7.1<\/code><\/p>\n\n\n\n<p>Save and exit the editor.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Flush DNS Cache<\/h4>\n\n\n\n<p>Flush the DNS cache to ensure your changes take effect:<\/p>\n\n\n\n<p>bashCopy code<\/p>\n\n\n\n<p><code>sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Testing Your Configuration<\/h3>\n\n\n\n<p>After setting up, test it with <code>nslookup<\/code> or <code>dig<\/code>:<\/p>\n\n\n\n<p>bashCopy code<\/p>\n\n\n\n<p><code>nslookup example.sf<\/code><\/p>\n\n\n\n<p>The server should now point to <code>172.16.7.1<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Troubleshooting<\/h3>\n\n\n\n<p>If the DNS queries are still being resolved by the default server (like Google&#8217;s 8.8.8.8), here are some things to check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Correct File and Syntax<\/strong>: Ensure <code>\/etc\/resolver\/sf<\/code> is correctly set up.<\/li>\n\n\n\n<li><strong>Permissions<\/strong>: Verify the file\u2019s permissions and ownership.<\/li>\n\n\n\n<li><strong>Direct Testing<\/strong>: Query the DNS server directly with <code>dig @172.16.7.1 example.sf<\/code>.<\/li>\n\n\n\n<li><strong>Network Connectivity<\/strong>: Confirm that <code>172.16.7.1<\/code> is reachable and correctly configured.<\/li>\n\n\n\n<li><strong>Restart Network Services<\/strong>: Sometimes, toggling network services can help.<\/li>\n\n\n\n<li><strong>Reboot<\/strong>: When in doubt, reboot!<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Introduction For someone who needs to direct traffic for specific domains to a particular server, setting up a split DNS configuration on macOS is a straightforward way to achieve this. Today, we&#8217;ll explore how to resolve all domains ending in .sf through a designated DNS server at 172.16.7.1. What is Split DNS? Split DNS is &hellip; <a href=\"https:\/\/sunapi386.ca\/wordpress\/how-to-set-up-split-dns-configuration-on-macos-for-specific-domains\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to Set Up Split DNS Configuration on macOS for Specific Domains<\/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-1095","post","type-post","status-publish","format-standard","hentry","category-thoughts"],"_links":{"self":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1095","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=1095"}],"version-history":[{"count":1,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/1095\/revisions\/1096"}],"wp:attachment":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}