Step 1 of 10: Introduction
Getting the network right in self-hosting is a balancing act. At home in Leiden I want speed, and on 4G/5G I want security and ad blocking.
- Time
- 4 min
- Steps
- 10
- Updated
- 19 Nov 2026
You will learn
- Introduction
- Why this setup
- Phase 1: configure the Unraid contaiβ¦
- Phase 2: fix the port conflict (YAMLβ¦
- Phase 3: Cloudflare Tunnel
This guide covers my split-horizon DNS setup. AdGuard Home, Tailscale and Cloudflare Tunnels on an Unraid 7 server need no open ports on the router (Ubiquiti Dream Router) and still give you access from anywhere to your local services like Emby, Sonarr, and Home Assistant. Recently I completely migrated to Tailscale.
Step 2 of 10: Why this setup
Running Tailscale next to web services often causes port conflicts. This configuration fixes a specific conflict inside the container and gives you:
- At Home: Low latency via local connections.
- Remote: Full encryption and ad-blocking via Tailscale VPN.
- Safety: No manual port forwarding needed.
- Trust: Valid Let’s Encrypt certificates managed via Nginx Proxy Manager.
Step 3 of 10: Phase 1: configure the Unraid container
We use the ghcr.io/mainfrezzer/adguardhome container, which has Tailscale built-in.
Network Settings:
- Network Type: Custom:
br0 - Fixed IP Address:
192.168.1.3(Your dedicated AdGuard IP)
Volume Mappings:
Map your certificates correctly, so AdGuard can serve DoH (DNS-over-HTTPS) securely.
/opt/adguardhome/confβ/mnt/user/appdata/adguard/config/opt/adguardhome/workβ/mnt/user/appdata/adguard/workingdir- Certificates:
- Container Path:
/certs - Host Path:
/mnt/user/appdata/Nginx-Proxy-Manager-Official/letsencrypt/ - Access Mode: Read Only (
ro)
- Container Path:
Environment Variables:
Add these manual variables to prevent the container from trying to manage its own certificates or internal serving:
TAILSCALE_ADVERTISE_ROUTES:192.168.1.0/24TAILSCALE_SERVE:0TAILSCALE_CERTS:0
Step 4 of 10: Phase 2: fix the port conflict (YAML edit)
By default, the Tailscale service in this specific container often hijacks port 443. To fix this, we move the AdGuard Home HTTPS interface to port 4443.
- Stop the AdGuard-Home-Unbound container.
- Open the Unraid Terminal.
- Edit your configuration file:
nano /mnt/user/appdata/adguard/config/AdGuardHome.yaml. - Locate the
tls:section and update the port:YAMLtls: enabled: true port: 4443 # Changed from 443 certificate_path: /certs/live/npm-1/fullchain.pem private_key_path: /certs/live/npm-1/privkey.pem(Note: Double-check thatnpm-1is your correct certificate folder usingls -l). - Save (Ctrl+O) and Exit (Ctrl+X), then restart the container.
Step 5 of 10: Phase 3: Cloudflare Tunnel
To make your DNS reachable via DNS-over-HTTPS (DoH) without opening ports, we use a Cloudflare Tunnel.
- Navigate to the Cloudflare Zero Trust Dashboard.
- Go to Access > Tunnels and edit your active tunnel.
- Add a Public Hostname (e.g.,
dns.example.com):- Service Type:
HTTPS - URL:
https://192.168.1.3:4443 - TLS Settings: Enable No TLS Verify (since we are using internal certificates).
- Service Type:
Step 6 of 10: Phase 4: Tailscale as a global VPN
Now make sure all your Tailscale devices (like your Samsung S25 Ultra) use AdGuard Home as their primary DNS.
Step A: Approve Subnet Routes
In the Tailscale Admin Console, find your AdGuard machine. Click the three dots β Edit route settings. Enable the checkbox for 192.168.1.0/24. This allows you to reach your local IPs (like your P1 Monitor on 192.168.1.42) from anywhere.
Step B: Global DNS Settings
In the DNS tab of the Tailscale Admin Console:
- Under Global Nameservers, click Add nameserver β Custom.
- Enter the Tailscale IP of your AdGuard container (e.g.,
100.x.x.x). - Disable “Restrict to domain”.
- Toggle Override local DNS to ON.
Step 7 of 10: Phase 5: mobile devices (Android/iOS)
To stop your phone from bypassing your settings:
- Android Settings: Go to Connections > More Connection Settings > Private DNS. Set this to OFF. If left on “Automatic,” Android might ignore your Tailscale DNS in favor of Google’s DNS.
- Tailscale App: Ensure it is active.
- The 4G Test: Turn off Wi-Fi. Try to access
http://192.168.1.2(your Nginx Proxy Manager). If it loads, the tunnel works.
Step 8 of 10: Phase 6: local optimization (split-brain DNS)
Local traffic should stay in the house, so you get gigabit speed on your own Wi-Fi.
1. UDM Configuration:
On your Ubiquiti Dream Router, set the DHCP DNS Server to 192.168.1.3. Now every device in your house uses AdGuard by default.
2. AdGuard DNS Rewrites:
Add the following rules in AdGuard Home under Filters > DNS Rewrites:
dns.example.comβ192.168.1.3(Keeps DNS traffic local).*.example.comβ192.168.1.2(Points all apps like Emby or Sonarr to Nginx).
Step 9 of 10: Traffic flow
| Location | Action | Traffic Path |
| At Home (Wi-Fi) | Accessing emby.example.com | Phone β AdGuard (Local) β Nginx (Local) β Direct Connection |
| On the Go (4G + Tailscale) | Accessing emby.example.com | Phone β Tailscale Tunnel β AdGuard Home β Subnet Route β Secure Tunnel |
| Public PC | Accessing dns.example.com | Browser β Cloudflare Tunnel β AdGuard Port 4443 β Secure DoH |
Step 10 of 10: Conclusion
With this split-horizon setup my connection to my Unraid server is fast and secure, and ad-free too, whether I am in my living room in Leiden or abroad.
Happy hosting!
