AdGuard Home: Self-Hosted DNS Ad Blocker and An Easier Alternative to PiHole
Video
Transcript
Hello, this is channel Easy Self Host.
In this video, we are going to run AdGuard Home.
AdGuard Home is another DNS based ad blocker, just like PiHole
but comes with more features out of the box.
In my PiHole video, we set up a DNS proxy to encrypt our DNS queries upstream.
The AdGuard Home supports this without any extra services.
Now let's get started to run it using Docker Compose like always.
Here is the Docker Compose file for the AdGuard Home.
We define the proxy network here, so we can expose the admin panel of AdGuard through
our proxy server with a safe connection (HTTPS).
Here we define two docker volumes to store the data
and configuration of the AdGuard Home.
For the service, we can use the official docker image.
And here we connect it to the proxy network.
For the port section, we need to expose the DNS port 53.
But here I'm not publish the ports to all the IP addresses like we often do.
That's because the port 53 on localhost is most likely be occupied by some system services,
and it's not easy to disable them in the right way.
So we can just publish the port to the server IP address.
Lastly, we need to mount our two volumes to the right directory.
Then we also need to update our proxy server configuration.
Here I proxy the domain adguard.home.easyselfhost.com to adguard at port 3000.
3000 is the default port for the admin panel.
After this, we can go to the server command line and find the AdGuard docker compose file.
And from here, we execute 'docker compose up -d' to start the service.
Besides this, let's not forget to refresh our proxy server configuration.
We can simply just restart our proxy server.
Now we can go to the AdGuard admin panel through the domain we have set.
In my case, it's adguard.home.easyselfhost.com.
Here we have to go through a setup process.
For the admin web interface, let's choose to host on port 3000 because we've already
set up that in the docker-compose.yml file.
We can leave the rest of the settings unchanged.
Then set up the username and password for the admin panel.
Now you will see a configuration guide for different kinds of platforms.
I think setting up the router is the easiest way
since that will apply to all your devices connected to the router.
When you finish the setup, you are likely to be directed to this empty page because
the setup page directs you to an address with a port number.
All you have to do is to remove that port number.
Now you can log in to your admin panel.
In the main dashboard, you can see the statistics of your past DNS queries.
Right now it's all empty because we haven't connected any device to it.
We can start configuring the AdGuard for example the DNS settings.
Here we can set up our upstream DNS.
AdGuard supports DNS over HTTPS out of the box if you put an upstream that supports it.
You can find a list of DNS providers through this link.
Personally, I'm using Cloudflare and Google in a load balancing way.
As an ad blocker, of course you can configure a list of domains you don't want to access.
Here the default is the AdGuard DNS filter.
We can use a domain name in this list to test if the AdGuard is working.
Let's choose this short adx.ws domain.
In the command line, we can use the dig command to test DNS.
For example, if we just type dig and the domain, it will get the
DNS record based on your default DNS setting.
In this case, the DNS gives back an actual IP address.
You can use add to point the DNS to the server you want to use.
In this case, we are pointing it to the AdGuard server.
Now we can see it gives back an invalid IP address.
That's how the AdGuard works.
We can also test a domain name that we don't want to block, say, easyselfhost.com.
And we can see it gives back an actual IP.
Back to the AdGuard admin panel, we can try another useful feature, which is the DNS rewrite.
With DNS rewrite, we can insert customized DNS records locally.
For example, we can force the AdGuard to resolve easyselfhost.com to a local IP address.
And we can then test it in the command line.
I think the most useful aspect of this feature is that you can store the DNS record for your
home server locally, so you can access your home services even without the Internet.
There are many other features.
For example, you can block social media or shopping services for some reasons.
Now I'm going to set up my router to use AdGuard as an upstream DNS.
Every router's admin page is different, but the idea is the same.
So you need to find the one DNS setting and change its DNS server.
You need to find a place you can specify the DNS server IP
and put in the IP address of your AdGuard server.
And now the router is using AdGuard as DNS.
If you go to the admin panel now, you will start seeing DNS traffic coming in from your router.
That's all for this video.
Please consider subscribing for content like this.
You can find the configuration files in this video on GitHub and the link is in the description below.
Thank you for watching.