Currently I’m running my own DNS server at home; AdGuard Home. While this runs perfectly, I had one issue…
Whenever I needed to update the docker, even though the update usually takes a couple of minutes, no internet was possible since the docker was being updated. This bothered me a lot and I had to think about an improvement.
The answer turned out to be simple: I needed a second AdGuard Home instance on my Synology NAS. While setting this up was straightforward, it also meant that I had to maintain two instances. That’s where AdGuard Home Sync comes in!
AdGuard Home Sync
AdGuard Home Sync is a Docker container which allows you to synchronize AdGuard Home configuration to replica instances. This is exactly what I needed! By default the following features are being synced, but you can adjust them to your needs. That’s what I did as I only need to synchronize some of the configuration.
- General Settings
- Filters
- Rewrites
- Services
- Clients
- DNS Config
- DHCP Config
- Theme
How To Install?
The GitHub page provides multiple ways of setting up AdGuard Home Sync, but my favorite approach is using a Docker Compose file:
---
version: "2.1"
services:
adguardhome-sync:
image: ghcr.io/bakito/adguardhome-sync
container_name: adguardhome-sync
command: run --config /config/adguardhome-sync.yaml
volumes:
- /path/to/appdata/config/adguardhome-sync.yaml:/config/adguardhome-sync.yaml
ports:
- 8080:8080
restart: unless-stopped
Setting up AdGuard Home Sync
This is extremely easy! Simply locate the adguardhome-sync.yaml and adjust it to your needs. Once configured, everything should work just fine, usually! 😉
No route to host?
Yeah, usually… After adjusting the .yaml file, I kept getting a “No Route To Host” error. Fortunately the solution was easy as I found out that this was related to Portainer’s Bridge network:
In case of issues with No such host and/or no route to host:
Seems with a custom bridge network **(not the default bridge)**, DNS name resolution is native so using the container name is the preferred method to ensure containers can always talk to one another. So I created a network within Portainer called AdGuardSync. Your AGH instance should now be part of two networks; the macvlan and the AdGuardSync network!
So as soon as I created a custom bridge network within Portainer, the issue was immediately solved and it’s been working without any issues so far! Now my AdGuard Home Instance is now part of two networks:
- MAC VLAN (For external communication)
- AdGuardSync Bridge (For Internal communication)
Conclusion:
This docker container is an absolute must-have if you’re running multiple AdGuard Home instances! Now I can update my main and replica instance without any DNS downtime. As a bonus I always have something to fall back on to! This makes things a bit easier!
While dealing with the logs and the “No Route To Host” issue, I learned something new: DNS name solution resolutions works natively with custom bridge networks, but not with the default bridge! That was unexpected, but a good lesson!