AdGuard: Difference between revisions

From FlowerHouseWiki
 
Line 22: Line 22:
<p>Added a script to the mikrotik scheduler to secure a fallback dns if AdGuard server fails</p>
<p>Added a script to the mikrotik scheduler to secure a fallback dns if AdGuard server fails</p>
<syntaxhighlight lang="console" line>
<syntaxhighlight lang="console" line>
# set variables
#Set variables
:local fallbackDNS 8.8.8.8,8.8.4.4;
:local fallbackDNS 8.8.8.8,8.8.4.4;
:local AdGuard 192.168.88.4;
:local AdGuard 192.168.88.4;

Latest revision as of 22:43, 21 February 2022

AdGuard-LXC
AdGuard.png

Network


IP: 192.168.88.2
MAC: 8E:02:AF:95:EB:35

System


OS: Debian Bullseye
RAM: 256MB
Cores: 1
Privileged: No

The AdGuard Home is reachable under 192.168.88.2 which is located in the ServerVLAN.

AdGuard Home serves as the DNS-Server for the internal network.

Basic Setup

Installation

Enter this command to install AdGuard

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v

Configure Mikrotik Router

Added a script to the mikrotik scheduler to secure a fallback dns if AdGuard server fails

#Set variables
:local fallbackDNS 8.8.8.8,8.8.4.4;
:local AdGuard 192.168.88.4;
:local currentDNS; 
:set $currentDNS [/ip dns get servers];

:do {
  :put [resolve google.com server=$AdGuard];
  if ($currentDNS!=AdGuard) do={
    :log info "DNS Failover: Switching to AdGuard";
    ip dns set servers $AdGuard
    ip dns cache flush
  } else={}
} on-error={ :set $currentDNS [/ip dns get servers];
  if ($currentDNS!=$fallbackDNS) do={
    :log info "DNS Failover: Switching to FallbackDNS"; 
    ip dns set servers $fallbackDNS;
  } else={:log info "DNS Failover: AdGuard Unavailable"} 
}

Sources