bulk load static leases #3305

Closed
opened 2026-03-04 03:23:05 -05:00 by deekerman · 4 comments
Owner

Originally created by @bullmoose20 on GitHub (Dec 24, 2021).

Issue Details

Version: v0.107.0
Channel: release
Go version: go1.16.12
Build time: 2021-12-21T13:56:36Z+0000
GOOS: linux
GOARCH: arm64
Race: false
Dependencies:
github.com/AdguardTeam/dnsproxy@v0.39.13 (sum: h1:7YM5Mr4EpFZ8UO4/4xd6zBG3lZ6AzZO6Xq29Cr4ydOY=)
github.com/AdguardTeam/golibs@v0.10.3 (sum: h1:FBgk17zf35ESVWQKIqEUiqqB2bDaCBC8X5vMU760yB4=)
github.com/AdguardTeam/urlfilter@v0.15.1 (sum: h1:dP6S7J6eFAk8MN4IDpUq2fZoBo8K8fmc6pXpxNIv84M=)
github.com/NYTimes/gziphandler@v1.1.1 (sum: h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=)
github.com/aead/chacha20@v0.0.0-20180709150244-8b13a72661da (sum: h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=)
github.com/aead/poly1305@v0.0.0-20180717145839-3fee0db0b635 (sum: h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=)
github.com/ameshkov/dnscrypt/v2@v2.2.2 (sum: h1:lxtS1iSA2EjTOMToSi+2+rwspNA+b/wG5/JpccvE9CU=)
github.com/ameshkov/dnsstamps@v1.0.3 (sum: h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=)
github.com/beefsack/go-rate@v0.0.0-20200827232406-6cde80facd47 (sum: h1:M57m0xQqZIhx7CEJgeLSvRFKEK1RjzRuIXiA3HfYU7g=)
github.com/cheekybits/genny@v1.0.0 (sum: h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=)
github.com/digineo/go-ipset/v2@v2.2.1 (sum: h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g=)
github.com/fsnotify/fsnotify@v1.4.9 (sum: h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=)
github.com/go-ping/ping@v0.0.0-20210506233800-ff8be3320020 (sum: h1:mdi6AbCEoKCA1xKCmp7UtRB5fvGFlP92PvlhxgdvXEw=)
github.com/google/go-cmp@v0.5.5 (sum: h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=)
github.com/google/gopacket@v1.1.19 (sum: h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=)
github.com/google/renameio@v1.0.1 (sum: h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU=)
github.com/AdguardTeam/dhcp@v0.0.0-20210519141215-51808c73c0bf (sum: h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=)
github.com/joomcode/errorx@v1.0.3 (sum: h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw=)
github.com/josharian/native@v0.0.0-20200817173448-b6b71def0850 (sum: h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA=)
github.com/kardianos/service@v1.2.0 (sum: h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=)
github.com/lucas-clemente/quic-go@v0.21.1 (sum: h1:uuhCcu885TE9u/piPYMChI/yqA1lXfaLUEx8uCMxf8w=)
github.com/marten-seemann/qtls-go1-16@v0.1.3 (sum: h1:XEZ1xGorVy9u+lJq+WXNE+hiqRYLNvJGYmwfwKQN2gU=)
github.com/mdlayher/ethernet@v0.0.0-20190606142754-0394541c37b7 (sum: h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=)
github.com/mdlayher/netlink@v1.4.0 (sum: h1:n3ARR+Fm0dDv37dj5wSWZXDKcy+U0zwcXS3zKMnSiT0=)
github.com/mdlayher/raw@v0.0.0-20210412142147-51b895745faf (sum: h1:InctQoB89TIkmgIFQeIL4KXNvWc1iebQXdZggqPSwL8=)
github.com/ameshkov/dns@v1.1.32-0.20211214123418-7a5e0dc5f1b0 (sum: h1:a6ca3WlDG4zvUWqVFpVu48b9NZJ0fUFlRhiZKKkq+aw=)
github.com/patrickmn/go-cache@v2.1.0+incompatible (sum: h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=)
github.com/pkg/errors@v0.9.1 (sum: h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=)
github.com/satori/go.uuid@v1.2.0 (sum: h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=)
github.com/ti-mo/netfilter@v0.4.0 (sum: h1:rTN1nBYULDmMfDeBHZpKuNKX/bWEXQUhe02a/10orzg=)
github.com/u-root/u-root@v7.0.0+incompatible (sum: h1:u+KSS04pSxJGI5E7WE4Bs9+Zd75QjFv+REkjy/aoAc8=)
go.etcd.io/bbolt@v1.3.6 (sum: h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=)
golang.org/x/crypto@v0.0.0-20210817164053-32db794688a5 (sum: h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=)
golang.org/x/net@v0.0.0-20210929193557-e81a3d93ecf6 (sum: h1:Z04ewVs7JhXaYkmDhBERPi41gnltfQpMWDnTnQbaCqk=)
golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c (sum: h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=)
golang.org/x/sys@v0.0.0-20210909193231-528a39cd75f3 (sum: h1:3Ad41xy2WCESpufXwgs7NpDSu+vjxqLt2UFqUV+20bI=)
golang.org/x/text@v0.3.7 (sum: h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=)
gopkg.in/natefinch/lumberjack.v2@v2.0.0 (sum: h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=)
gopkg.in/yaml.v2@v2.4.0 (sum: h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=)
howett.net/plist@v0.0.0-20201203080718-1454fab16a06 (sum: h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58=)

  • Version of AdGuard Home server:
    • Version: v0.107.0
  • How did you install AdGuard Home:
    • curl command as listed on github
  • How did you setup DNS configuration:
    • iOT
  • If it's a router or IoT, please write device model:
    • rpi3
  • CPU architecture:
  • Operating system and version:
    • ubuntu 20.04.3 LTS

Expected Behavior

Ability to export/import static leases as I am migrating from one AdGuard Home server running on container in Unraid to another one running on RPI3 so that I can shutdown container and run dedicated.

Actual Behavior

I tried to stop both instances and copied everything to the new rpi3 adguard, made some slight adjustments to yaml file to reflect the new IP of the RPI3 machine and restarted Adguard home... all came except not the leases.

Screenshots

Screenshot:

Additional Information

Is there a CLI or instructions on backup and then restore to another machine?

Originally created by @bullmoose20 on GitHub (Dec 24, 2021). ### Issue Details <!-- Please include all relevant details about the environment you experienced the bug in. If possible, include the result of running `./AdGuardHome -v --version` from the installation directory. --> Version: v0.107.0 Channel: release Go version: go1.16.12 Build time: 2021-12-21T13:56:36Z+0000 GOOS: linux GOARCH: arm64 Race: false Dependencies: github.com/AdguardTeam/dnsproxy@v0.39.13 (sum: h1:7YM5Mr4EpFZ8UO4/4xd6zBG3lZ6AzZO6Xq29Cr4ydOY=) github.com/AdguardTeam/golibs@v0.10.3 (sum: h1:FBgk17zf35ESVWQKIqEUiqqB2bDaCBC8X5vMU760yB4=) github.com/AdguardTeam/urlfilter@v0.15.1 (sum: h1:dP6S7J6eFAk8MN4IDpUq2fZoBo8K8fmc6pXpxNIv84M=) github.com/NYTimes/gziphandler@v1.1.1 (sum: h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=) github.com/aead/chacha20@v0.0.0-20180709150244-8b13a72661da (sum: h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=) github.com/aead/poly1305@v0.0.0-20180717145839-3fee0db0b635 (sum: h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=) github.com/ameshkov/dnscrypt/v2@v2.2.2 (sum: h1:lxtS1iSA2EjTOMToSi+2+rwspNA+b/wG5/JpccvE9CU=) github.com/ameshkov/dnsstamps@v1.0.3 (sum: h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=) github.com/beefsack/go-rate@v0.0.0-20200827232406-6cde80facd47 (sum: h1:M57m0xQqZIhx7CEJgeLSvRFKEK1RjzRuIXiA3HfYU7g=) github.com/cheekybits/genny@v1.0.0 (sum: h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE=) github.com/digineo/go-ipset/v2@v2.2.1 (sum: h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g=) github.com/fsnotify/fsnotify@v1.4.9 (sum: h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=) github.com/go-ping/ping@v0.0.0-20210506233800-ff8be3320020 (sum: h1:mdi6AbCEoKCA1xKCmp7UtRB5fvGFlP92PvlhxgdvXEw=) github.com/google/go-cmp@v0.5.5 (sum: h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=) github.com/google/gopacket@v1.1.19 (sum: h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=) github.com/google/renameio@v1.0.1 (sum: h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU=) github.com/AdguardTeam/dhcp@v0.0.0-20210519141215-51808c73c0bf (sum: h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=) github.com/joomcode/errorx@v1.0.3 (sum: h1:3e1mi0u7/HTPNdg6d6DYyKGBhA5l9XpsfuVE29NxnWw=) github.com/josharian/native@v0.0.0-20200817173448-b6b71def0850 (sum: h1:uhL5Gw7BINiiPAo24A2sxkcDI0Jt/sqp1v5xQCniEFA=) github.com/kardianos/service@v1.2.0 (sum: h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=) github.com/lucas-clemente/quic-go@v0.21.1 (sum: h1:uuhCcu885TE9u/piPYMChI/yqA1lXfaLUEx8uCMxf8w=) github.com/marten-seemann/qtls-go1-16@v0.1.3 (sum: h1:XEZ1xGorVy9u+lJq+WXNE+hiqRYLNvJGYmwfwKQN2gU=) github.com/mdlayher/ethernet@v0.0.0-20190606142754-0394541c37b7 (sum: h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=) github.com/mdlayher/netlink@v1.4.0 (sum: h1:n3ARR+Fm0dDv37dj5wSWZXDKcy+U0zwcXS3zKMnSiT0=) github.com/mdlayher/raw@v0.0.0-20210412142147-51b895745faf (sum: h1:InctQoB89TIkmgIFQeIL4KXNvWc1iebQXdZggqPSwL8=) github.com/ameshkov/dns@v1.1.32-0.20211214123418-7a5e0dc5f1b0 (sum: h1:a6ca3WlDG4zvUWqVFpVu48b9NZJ0fUFlRhiZKKkq+aw=) github.com/patrickmn/go-cache@v2.1.0+incompatible (sum: h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=) github.com/pkg/errors@v0.9.1 (sum: h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=) github.com/satori/go.uuid@v1.2.0 (sum: h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=) github.com/ti-mo/netfilter@v0.4.0 (sum: h1:rTN1nBYULDmMfDeBHZpKuNKX/bWEXQUhe02a/10orzg=) github.com/u-root/u-root@v7.0.0+incompatible (sum: h1:u+KSS04pSxJGI5E7WE4Bs9+Zd75QjFv+REkjy/aoAc8=) go.etcd.io/bbolt@v1.3.6 (sum: h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=) golang.org/x/crypto@v0.0.0-20210817164053-32db794688a5 (sum: h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=) golang.org/x/net@v0.0.0-20210929193557-e81a3d93ecf6 (sum: h1:Z04ewVs7JhXaYkmDhBERPi41gnltfQpMWDnTnQbaCqk=) golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c (sum: h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=) golang.org/x/sys@v0.0.0-20210909193231-528a39cd75f3 (sum: h1:3Ad41xy2WCESpufXwgs7NpDSu+vjxqLt2UFqUV+20bI=) golang.org/x/text@v0.3.7 (sum: h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=) gopkg.in/natefinch/lumberjack.v2@v2.0.0 (sum: h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=) gopkg.in/yaml.v2@v2.4.0 (sum: h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=) howett.net/plist@v0.0.0-20201203080718-1454fab16a06 (sum: h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58=) * **Version of AdGuard Home server:** * <!-- (e.g. v0.123.4) -->Version: v0.107.0 * **How did you install AdGuard Home:** * <!-- (e.g. Built from source, Snapcraft, Docker, GitHub releases, etc.) --> curl command as listed on github * **How did you setup DNS configuration:** * <!-- (System/Router/IoT) --> iOT * **If it's a router or IoT, please write device model:** * <!-- (e.g. Raspberry Pi 3 Model B) --> rpi3 * **CPU architecture:** * <!-- (e.g. AMD64, MIPS, etc.) --> * **Operating system and version:** * <!-- (e.g. Ubuntu 18.04.1) -->ubuntu 20.04.3 LTS ### Expected Behavior <!-- A clear and concise description of what you expected to happen. --> Ability to export/import static leases as I am migrating from one AdGuard Home server running on container in Unraid to another one running on RPI3 so that I can shutdown container and run dedicated. ### Actual Behavior <!-- A clear and concise description of what actually happened. --> I tried to stop both instances and copied everything to the new rpi3 adguard, made some slight adjustments to yaml file to reflect the new IP of the RPI3 machine and restarted Adguard home... all came except not the leases. ### Screenshots <!-- If applicable, add screenshots to help explain your problem. --> <details><summary>Screenshot:</summary> <!--- drag and drop, upload or paste your screenshot to this area--> </details> ### Additional Information <!-- Add any other context about the problem here. --> Is there a CLI or instructions on backup and then restore to another machine?
deekerman 2026-03-04 03:23:05 -05:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@ainar-g commented on GitHub (Dec 24, 2021):

Hello. This feature request is a partial duplicate of #1147.

Is there a CLI or instructions on backup and then restore to another machine?

The leases are kept in the file leases.db in the AdGuard Home working directory. The format isn't stable, but it's basically a JSON array where host is the hostname of the machine, exp is 1 for static leases, and mac and ip are the base64 encoded MAC address and IP address of the machine respectively. Example:

[{"mac":"CAAnids/","ip":"wKg4Bg==","host":"server-2","exp":1}]

This format is very likely to change.

Another option is to use the JSON HTTP API (also likely to change, we have a separate changelog for it).

@ainar-g commented on GitHub (Dec 24, 2021): Hello. This feature request is a partial duplicate of #1147. > Is there a CLI or instructions on backup and then restore to another machine? The leases are kept in the file `leases.db` in the AdGuard Home working directory. The format isn't stable, but it's basically a JSON array where `host` is the hostname of the machine, `exp` is `1` for static leases, and `mac` and `ip` are the base64 encoded MAC address and IP address of the machine respectively. Example: ```json [{"mac":"CAAnids/","ip":"wKg4Bg==","host":"server-2","exp":1}] ``` **This format is very likely to change.** Another option is to use the [JSON HTTP API][1] (also likely to change, we have a separate [changelog][2] for it). [1]: https://github.com/AdguardTeam/AdGuardHome/blob/52f36f201eb559543a13ed571faaf3c5ca9745f7/openapi/openapi.yaml#L427 [2]: https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/CHANGELOG.md
Author
Owner

@bullmoose20 commented on GitHub (Dec 24, 2021):

image

So.. what are the other .leases.* files?

shouldn't I be able to copy the leases.db file from the source and then they would "show" up in the static leases section on the new server after restarting it?

@bullmoose20 commented on GitHub (Dec 24, 2021): ![image](https://user-images.githubusercontent.com/12549033/147369729-d9788167-b3f6-45ec-9d2d-ff48d2521330.png) So.. what are the other .leases.* files? shouldn't I be able to copy the leases.db file from the source and then they would "show" up in the static leases section on the new server after restarting it?
Author
Owner

@bullmoose20 commented on GitHub (Dec 24, 2021):

ok. so stopping the service on both existing and new, copying over leases.db, restarting on the new machine, enabling DHCP, and then refreshing the page did the trick.... it tool a while for the UI to populate the static leases when I tried it last night... so I think I am OK and I deleted those .leases.db* files as I am pretty sure they are not needed

@bullmoose20 commented on GitHub (Dec 24, 2021): ok. so stopping the service on both existing and new, copying over leases.db, restarting on the new machine, enabling DHCP, and then refreshing the page did the trick.... it tool a while for the UI to populate the static leases when I tried it last night... so I think I am OK and I deleted those .leases.db* files as I am pretty sure they are not needed
Author
Owner

@bullmoose20 commented on GitHub (Dec 24, 2021):

I was able to successfully migrate my information and data from the old AdGuard Home container running on Unraid to the new RPI3 Ubuntu 20.04.3 LTS version of AdGuard Home

@bullmoose20 commented on GitHub (Dec 24, 2021): I was able to successfully migrate my information and data from the old AdGuard Home container running on Unraid to the new RPI3 Ubuntu 20.04.3 LTS version of AdGuard Home
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AdGuardHome#3305
No description provided.