--> adguard home to container | by @xdenb43
--> tested on hap ax3/ROS 7.17.2+
Important
defconf network 192.168.88.1/24
docker network 192.168.254.1/24
- Containers are enabled following official docs
/system/device-mode/update container=yes
- USB flash drive is formatted to ext4 and connected as /usb1
It's also possible to use RAM and Network spaces, but please update path to follow yours config then
- VETH interface and Bridge
/interface veth
add address=192.168.254.5/24 gateway=192.168.254.1 name=ADGUARD-HOME
/interface bridge
add name=Bridge-Docker port-cost-mode=short
/interface bridge port
add bridge=Bridge-Docker interface=ADGUARD-HOME
/ip address
add address=192.168.254.1/24 interface=Bridge-Docker network=192.168.254.0
- NAT Firewall to allow outgoing requests from AGH
/ip firewall nat
add action=masquerade chain=srcnat comment=AdGuardHome src-address=192.168.254.5
- Containers
RAM limitation to 200Mb is optional
/container config
set ram-high=200.0MiB registry-url=https://registry-1.docker.io tmpdir=/usb1/docker/pull
/container mounts
add dst=/opt/adguardhome/conf name=adguard_home_conf src=/usb1/docker_configs/adguard_home
/container
add cmd="-c /opt/adguardhome/conf/AdGuardHome.yaml -h 0.0.0.0 -w /opt/adguardhome/work" entrypoint=/opt/adguardhome/AdGuardHome interface=ADGUARD-HOME logging=yes mounts=\
adguard_home_conf root-dir=/usb1/docker/adguard_home start-on-boot=yes workdir=/opt/adguardhome/work remote-image=adguard/adguardhome:latest
- Check newly added container state changed from extracting to stopped
/container/print where interface=ADGUARD-HOME
/container/start [find where interface=ADGUARD-HOME]
AGH is now available by ip http://192.168.254.5:3000/
Just open link
Follow initial configuration wizard
Choose one of the options below
Just set AGH ip as DNS server, redirect DNS request to MikroTik
Warning
DNS FWD will work
No device-related dns stats will be gathered (all dns requests are coming from mikrotik)
/ip dns
set allow-remote-requests=yes servers=192.168.254.5
/ip firewall nat
add action=redirect chain=dstnat comment="Incoming DNS redirect" dst-address-type=!local dst-port=53 in-interface-list=LAN protocol=udp
add action=redirect chain=dstnat comment="Incoming DNS redirect" dst-address-type=!local dst-port=53 in-interface-list=LAN protocol=tcp
Forward all DNS requests to AGH
Warning
DNS FWD will NOT work
AGH WILL SHOW dns stats for every LAN device
/ip firewall nat
add action=dst-nat chain=dstnat comment="local AdGuard udp - NO NAT Loopback / local addresses only!" dst-address-type=local dst-port=53 in-interface-list=LAN protocol=udp \
to-addresses=192.168.254.5 to-ports=53
add action=dst-nat chain=dstnat comment="local AdGuard tcp" dst-address-type=local dst-port=53 in-interface-list=LAN protocol=tcp to-addresses=192.168.254.5 to-ports=53

