18/09/2023, 23:09
adguard opnsense dns network

AdGuard Home alongside OPNsense

This is a small tutorial about how to install OPNsense and AdGuard Home side by side on a sigle machine.

Preparation

If you already have an OPNsense installation running, installing AdGuard Home on the same machine can be a pain. But it is not that difficult as you might think. So, let’s get started. If you want to be able to access the registered DHCP leases from OPNsense in AdGuard Home you need to setup Unbound DNS in OPNsense. First you must change the port of the DNS server to a different one. I am using port 5533 but you can use any other free port. Next you need to enable the Register ISC DHCP4 Leases checkbox and starting the service.

Installing AdGuard Home

Now everything has been prepared to continue with the installation. To install AdGuard Home just execute the following command in the shell of OPNsense.

fetch -o - https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v

Start and configure

After successfully installing we can start configuring AdGuard Home for accessing the leases from Unbound DNS. To do so first you need to start AdGuard Home by the following command.

/opt/AdGuardHome/AdGuardHome -s start

After a few seconds you should be able to access the web frontend at http://<your-ip>:3000. To continue you need to create a new user.

If you are logged in, navigate to Settings > DNS settings and scroll down to Private reverse DNS servers. Here you should add [::1]:5533or127.0.0.1:5533 to let AdGuard Home know where to look for the leases. Keep in mind that you need to adjust the port to the one you configured.

System boot

Finally, we need to make sure that AdGuard Home starts when the machine boots up. The following commands can be used to accomplish this task.

echo '/opt/AdGuardHome/AdGuardHome -s start' > /usr/local/etc/rc.syshook.d/early/50-adguardhome
chmod 755 /usr/local/etc/rc.syshook.d/early/50-adguardhome