Configure AdGuard Home with Raspberry Pi
Published: 2022-01-26 07:14:07


![AdGuard Home](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5aqdwol7d817gnm15q3.png)

### Intro
I was using [NextDNS](https://dev.to/xceed/taking-control-of-privacy-using-nextdns-1gde) for couple months and recently switched to AdGaurd Home as it is more advanced. It's bit more complex to setup as compare to NextDNS. I have faced many challenges while configuring with Raspberry Pi, however, struggling for a day or two I am finally able to configure it. Hence, thought to create a step-by-step guide hoping this might help someone facing similar issues.

### AdGuard Home (AGH)
It's a free and open source, network-wide software for blocking ads & tracking. After you set up, it'll cover all your devices without needing any client-side software. You can read more about AdGuard Home at https://adguard.com/en/adguard-home/overview.html

### Installation
>Go to [release page](https://github.com/AdguardTeam/AdGuardHome/releases), download and unpack binaries on your pi using following command -
>```
wget 'https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv6.tar.gz'
tar -f AdGuardHome_linux_armv6.tar.gz -x -v
```

<!-- Installing as service -->
>Below commands will install AGH as a service so if your pi restart it will start automatically.
>```
cd ./AdGuardHome/
sudo ./AdGuardHome -s install
```

<!-- Commands for service -->
>Here are the other commands you might need to control the service:
>```
AdGuardHome -s uninstall: uninstall the AdGuard Home service.
AdGuardHome -s start: start the service.
AdGuardHome -s stop: stop the service.
AdGuardHome -s restart: restart the service.
AdGuardHome -s status: show the current service status.
```

### Initial Setup
>By default AGH runs on port 53, hence you can start initial setup by visiting `{raspberrypi-ip-address}:53` from any device in your network. Once you complete the initial setup you will be redirected to Dashboard.

>You can test your setup by visiting some website or running following command to test and dashboard on AGH will show data -
>```
nslookup github.com {raspberrypi-ip-address}
```

### Configure AGH on Router
> 1. Get the AGH listening IP address (usually device IP where AGH is running) from Setup Guide tab
> 2. Login to your router and add your Raspberry-Pi IP address as primary DNS server. If your router, doesn't allow you to add IP from same subnet, you can add Primary DNS in DHCP Server settings and it should work.
> 3. That's it. Traffic from devices in your network should appear in AGH Dashboard.

### Upstream & Bootstrap DNS
>AGH works as a proxy, therefore, you can redirect unblocked traffic to your favorite DNS servers. Upstream DNS providers will handle your traffic and Bootstrap DNS will be used to resolve upstream DNS providers. 

>It's super easy to configure Upstream and Bootstrap DNS servers. Pick one or more [DNS server providers](https://kb.adguard.com/general/dns-providers) and add them to ADH > Settings > DNS Settings > Upstream and Bootstrap DNS section. 

### DNS Blocklist
>Now you can go to Filter > DNS Blocklist and select predefined blocklists to add them and AGH will start blocking ads and tracking domain.