Synchronize AdGuardHome config to replica instances.
Please check the wiki for FAQ and Deprecations.
- General Settings
- Filters
- Rewrites
- Services
- Clients
- DNS Config
- DHCP Config
- Theme
By default, all features are enabled. Single features can be disabled in the config.
New AdGuardHome replica instances can be automatically installed if enabled via the config autoSetup. During automatic installation, the admin interface will be listening on port 3000 in runtime.
To skip automatic setup
Get from releases or install from source
go install github.com/bakito/adguardhome-sync@latestBoth the origin instance and replica(s) must be initially set up with AdguardHome via the AdguardHome installation wizard.
For Replicas replace # with the index number for the replica. E.g.: REPLICA#_URL -> REPLICA1_URL
| Name | Type | Description |
|---|---|---|
| CRON (string) | string | Cron expression for the sync interval |
| RUN_ON_START (bool) | bool | Run the sync on startup |
| PRINT_CONFIG_ONLY (bool) | bool | Print current config only and stop the application |
| CONTINUE_ON_ERROR (bool) | bool | Continue sync on errors |
| ORIGIN_URL (string) | string | URL of adguardhome instance |
| ORIGIN_WEB_URL (string) | string | Web URL of adguardhome instance |
| ORIGIN_API_PATH (string) | string | API Path |
| ORIGIN_USERNAME (string) | string | Adguardhome username |
| ORIGIN_PASSWORD (string) | string | Adguardhome password |
| ORIGIN_COOKIE (string) | string | Adguardhome cookie |
| ORIGIN_REQUEST_HEADERS (map) | map | Request Headers 'key1:value1,key2:value2' |
| ORIGIN_INSECURE_SKIP_VERIFY (bool) | bool | Skip TLS verification |
| ORIGIN_AUTO_SETUP (bool) | bool | Automatically setup the instance if it is not initialized |
| ORIGIN_INTERFACE_NAME (string) | string | Network interface name |
| ORIGIN_DHCP_SERVER_ENABLED (bool) | bool | Enable DHCP server |
| REPLICA#_URL (string) | string | URL of adguardhome instance |
| REPLICA#_WEB_URL (string) | string | Web URL of adguardhome instance |
| REPLICA#_API_PATH (string) | string | API Path |
| REPLICA#_USERNAME (string) | string | Adguardhome username |
| REPLICA#_PASSWORD (string) | string | Adguardhome password |
| REPLICA#_COOKIE (string) | string | Adguardhome cookie |
| REPLICA#_REQUEST_HEADERS (map) | map | Request Headers 'key1:value1,key2:value2' |
| REPLICA#_INSECURE_SKIP_VERIFY (bool) | bool | Skip TLS verification |
| REPLICA#_AUTO_SETUP (bool) | bool | Automatically setup the instance if it is not initialized |
| REPLICA#_INTERFACE_NAME (string) | string | Network interface name |
| REPLICA#_DHCP_SERVER_ENABLED (bool) | bool | Enable DHCP server |
| API_PORT (int) | int | API port (API is disabled if port is set to 0) |
| API_USERNAME (string) | string | API username |
| API_PASSWORD (string) | string | API password |
| API_DARK_MODE (bool) | bool | API dark mode |
| API_METRICS_ENABLED (bool) | bool | Enable metrics |
| API_METRICS_SCRAPE_INTERVAL (int64) | int64 | Interval for metrics scraping |
| API_METRICS_QUERY_LOG_LIMIT (int) | int | Metrics log query limit |
| API_TLS_CERT_DIR (string) | string | API TLS certificate directory |
| API_TLS_CERT_NAME (string) | string | API TLS certificate file name |
| API_TLS_KEY_NAME (string) | string | API TLS key file name |
| FEATURES_DNS_ACCESS_LISTS (bool) | bool | Sync DNS access lists |
| FEATURES_DNS_SERVER_CONFIG (bool) | bool | Sync DNS server config |
| FEATURES_DNS_REWRITES (bool) | bool | Sync DNS rewrites |
| FEATURES_DHCP_SERVER_CONFIG (bool) | bool | Sync DHCP server config |
| FEATURES_DHCP_STATIC_LEASES (bool) | bool | Sync DHCP static leases |
| FEATURES_GENERAL_SETTINGS (bool) | bool | Sync general settings |
| FEATURES_QUERY_LOG_CONFIG (bool) | bool | Sync query log config |
| FEATURES_STATS_CONFIG (bool) | bool | Sync stats config |
| FEATURES_CLIENT_SETTINGS (bool) | bool | Sync client settings |
| FEATURES_SERVICES (bool) | bool | Sync services |
| FEATURES_FILTERS (bool) | bool | Sync filters |
| FEATURES_THEME (bool) | bool | Sync the web UI theme |
| FEATURES_TLS_CONFIG (bool) | bool | Sync the TLS config |
location: $HOME/.adguardhome-sync.yaml
cron: # (string) Cron expression for the sync interval
runOnStart: # (bool) Run the sync on startup
printConfigOnly: # (bool) Print current config only and stop the application
continueOnError: # (bool) Continue sync on errors
origin: # (struct) Origin instance
url: # (string) URL of adguardhome instance
webURL: # (string) Web URL of adguardhome instance
apiPath: # (string) API Path
username: # (string) Adguardhome username
password: # (string) Adguardhome password
cookie: # (string) Adguardhome cookie
requestHeaders: # (map) Request Headers 'key1:value1,key2:value2'
insecureSkipVerify: # (bool) Skip TLS verification
autoSetup: # (bool) Automatically setup the instance if it is not initialized
interfaceName: # (string) Network interface name
dhcpServerEnabled: # (bool) Enable DHCP server
replica: # (struct) Single or replica instance (don't use in combination with replicas')
url: # (string) URL of adguardhome instance
webURL: # (string) Web URL of adguardhome instance
apiPath: # (string) API Path
username: # (string) Adguardhome username
password: # (string) Adguardhome password
cookie: # (string) Adguardhome cookie
requestHeaders: # (map) Request Headers 'key1:value1,key2:value2'
insecureSkipVerify: # (bool) Skip TLS verification
autoSetup: # (bool) Automatically setup the instance if it is not initialized
interfaceName: # (string) Network interface name
dhcpServerEnabled: # (bool) Enable DHCP server
replicas: # (struct) List or replica instances (don't use in combination with replicas')
- url: # (string) URL of adguardhome instance
webURL: # (string) Web URL of adguardhome instance
apiPath: # (string) API Path
username: # (string) Adguardhome username
password: # (string) Adguardhome password
cookie: # (string) Adguardhome cookie
requestHeaders: # (map) Request Headers 'key1:value1,key2:value2'
insecureSkipVerify: # (bool) Skip TLS verification
autoSetup: # (bool) Automatically setup the instance if it is not initialized
interfaceName: # (string) Network interface name
dhcpServerEnabled: # (bool) Enable DHCP server
api: # (struct)
port: # (int) API port (API is disabled if port is set to 0)
username: # (string) API username
password: # (string) API password
darkMode: # (bool) API dark mode
metrics: # (struct)
enabled: # (bool) Enable metrics
scrapeInterval: # (int64) Interval for metrics scraping
queryLogLimit: # (int) Metrics log query limit
tls: # (struct)
certDir: # (string) API TLS certificate directory
certName: # (string) API TLS certificate file name
keyName: # (string) API TLS key file name
features: # (struct)
dns: # (struct)
accessLists: # (bool) Sync DNS access lists
serverConfig: # (bool) Sync DNS server config
rewrites: # (bool) Sync DNS rewrites
dhcp: # (struct)
serverConfig: # (bool) Sync DHCP server config
staticLeases: # (bool) Sync DHCP static leases
generalSettings: # (bool) Sync general settings
queryLogConfig: # (bool) Sync query log config
statsConfig: # (bool) Sync stats config
clientSettings: # (bool) Sync client settings
services: # (bool) Sync services
filters: # (bool) Sync filters
theme: # (bool) Sync the web UI theme
tlsConfig: # (bool) Sync the TLS configSome instances of AdGuard Home do not support basic authentication. For instance, many routers with built-in Adguard Home support do not. If this is the case, a valid cookie may be provided instead. If the router protects the AdGuard instance behind its own authentication, the cookie from an authenticated request may allow the sync to succeed.
- This has been tested successfully against GL.Inet routers with AdGuard Home.
- Note: due to the short validity of cookies, this approach is likely only suitable for one-time syncs
export LOG_LEVEL=info
export ORIGIN_URL=https://192.168.1.2:3000
export ORIGIN_USERNAME=username
export ORIGIN_PASSWORD=password
# export ORIGIN_COOKIE=Origin-Cookie-Name=CCCOOOKKKIIIEEE
export REPLICA1_URL=http://192.168.1.3
export REPLICA1_USERNAME=username
export REPLICA1_PASSWORD=password
# export REPLICA_COOKIE=Replica-Cookie-Name=CCCOOOKKKIIIEEE
# run once
adguardhome-sync run
# run as daemon
adguardhome-sync run --cron "0 */2 * * *"Verified on Ubuntu Linux 24.04
Assume you have downloaded the the adguardhome-sync binary to /opt/adguardhome-sync.
Create systemd service file /opt/adguardhome-sync/adguardhome-sync.service:
[Unit]
Description = AdGuardHome Sync
After = network.target
[Service]
ExecStart = /opt/adguardhome-sync/adguardhome-sync --config /opt/adguardhome-sync/adguardhome-sync.yaml run
[Install]
WantedBy = multi-user.target
Create a configuration file /opt/adguardhome-sync/adguardhome-sync.yaml, please follow Config file
section below for details.
Install and enable service:
sudo cp /opt/adguardhome-sync/adguardhome-sync.service /etc/systemd/system/
sudo systemctl enable adguardhome-sync.service
sudo systemctl start adguardhome-sync.service
Then you can check the status:
sudo systemctl status adguardhome-sync.service
If web UI has been enabled in configuration (default port is 8080), can also check the status via
http://<server-IP>:8080
@ECHO OFF
@TITLE AdGuardHome-Sync
REM set LOG_LEVEL=debug
set LOG_LEVEL=info
REM set LOG_LEVEL=warn
REM set LOG_LEVEL=error
set ORIGIN_URL=http://192.168.1.2:3000
set ORIGIN_USERNAME=username
set ORIGIN_PASSWORD=password
# set ORIGIN_COOKIE=Origin-Cookie-Name=CCCOOOKKKIIIEEE
set REPLICA1_URL=http://192.168.2.2:3000
set REPLICA1_USERNAME=username
set REPLICA1_PASSWORD=password
# set REPLICA1_COOKIE=Replica-Cookie-Name=CCCOOOKKKIIIEEE
set FEATURES_DHCP_SERVER_CONFIG=false
set FEATURES_DHCP_STATIC_LEASES=false
# run once
adguardhome-sync run
# run as daemon
adguardhome-sync run --cron "0 */2 * * *"docker run -d \
--name=adguardhome-sync \
-p 8080:8080 \
-v /path/to/appdata/config/adguardhome-sync.yaml:/config/adguardhome-sync.yaml \
--restart unless-stopped \
ghcr.io/bakito/adguardhome-sync:latest---
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-stoppedNote when running the Docker container in Unraid please remove unneeded env variables. If replica2 isn't used, this can cause sync errors.
To enable syncing with a Home Assistant instance using the AdGuard Home Add-on, you will need to enable the disabled ports, under the Network heading
And then set the port of your choice for the Web interface
Don't forget to save and restart the add-on.
Depending on your setup, you may also need to disable SSL for the add-on.
The username:password required for the Home Assistant replica is the one you use to login to your instance, however it's recommended to setup a new local only user with minimal permissions.
All credit for this method goes to Brunty who has a far more detailed write up about this on his blog.
The log level can be set with the environment variable: LOG_LEVEL
The following log levels are supported (default: info)
- debug
- info
- warn
- error
Default log format is console.
It can be changed to json by setting the environment variable: LOG_FORMAT=json.

