Eduard's Blog

Using Split DNS with Adguard Home and Traefik

Cover Image for Using Split DNS with Adguard Home and Traefik
Eduard
Eduard

In this guide, we will walk through the process of setting up Split DNS using Adguard Home to improve the performance of your web applications. Split DNS allows you to resolve DNS queries differently based on your network location, ensuring that your apps can be accessed more efficiently whether you're at home or remote. This setup assumes you already have a reverse proxy in place and you are able to access the app remotely from app1.yourdomain.com.

Prerequisites

Before we begin, make sure you have the following components in place:

  1. Adguard Home: Adguard Home is an open-source ad-blocking and privacy protection software that can be used as a DNS server. You can install it on your local network, and it will become your local DNS server.

  2. Reverse Proxy: You should have a reverse proxy (such as Traefik or Nginx) already set up and configured to map your web applications to subdomains. This ensures that your apps are accessible via specific subdomains like app1.yourdomain.com.

Step 1: Install and Configure Adguard Home

  1. Install Adguard Home on your local network. You can follow the installation instructions provided on the Adguard Home website for your specific platform.

  2. Access the Adguard Home web interface by navigating to its web address, usually http://adguard-home.local or the IP address of the machine where Adguard Home is installed.

  3. In the Adguard Home web interface, navigate to the "Filters" => "DNS rewrites" section.

  4. Add a custom DNS rule for your app's subdomain. This custom rule should point to the internal/local IP address where your web application is hosted.

  5. Save the settings. Adguard Home is now configured to resolve DNS queries for your specified subdomains to the local IP address when you're at home.

Step 2: Verify Split DNS Configuration

To ensure that your Split DNS setup is working correctly, perform the following steps:

  1. From a device on your local network, try accessing your web application using the subdomain, e.g., app1.yourdomain.com. It should load quickly as the DNS resolution will direct you to the local IP address. You can try to ping the subdomain and if the resolved IP matches the local IP then you're acecessing it locally.

  2. From a remote location or outside your home network, access the same subdomain. The DNS resolution should direct you to the public IP address of your server.

This Split DNS setup ensures that you experience faster access to your web applications while at home, and the same applications are still accessible remotely when you're away. This optimizes the performance of your web apps and enhances the overall user experience.

That's it! You've successfully set up Split DNS using Adguard Home in conjunction with your existing reverse proxy configuration. Enjoy faster and more efficient access to your web applications.