Important or Recent Updates
Historic Updates | Date |
---|---|
Updated guide for Container Manager and using MacVLAN | 13/05/2023 |
Added a new section to ensure DSM continues having network access. | 02/06/2023 |
Guide updated so you can choose between Macvlan or Bridge mode | 12/08/2023 |
Added additional security option to the compose to restrict the container from gaining new privileges | 25/10/2023 |
Removed the requirement for the synobridge as this container can just use its own bridge, and added the Host network mode, so all three are a choice. | 21/01/2024 |
remove the requirement for the docker user as this container has no method to run via a mapped user | 04/07/2024 |
Aligned the Macvlan settings with the PiHole guide | 01/08/2024 |
What is AdGuard Home?
AdGuard Home is network-wide ad blocking solution. After you set it up, it’ll cover all your home devices, it even includes a parental control solution. Just like a PiHole it acts as your home network DNS server and will block advertising on any site you visit.
This guide will get you set up with AdGuard and cover some basic initial settings, I recommend checking out the documentation for all the various features available.
Host vs Macvlan vs Bridge Network Modes
Host:
Host mode uses your NAS underlying network to run the containers network services, so it will be reliant on the NAS not using any of the required ports for the container. However, this makes it easy to set up, but you need to make sure no other service is using the required ports. All your clients will appear correctly as independent devices and stats.
Macvlan:
This gives you the benefit of AdGuard having its own IP address on your network, all clients appear with their real IP addresses allowing you to assign specific rules and give you some nicer stats just like Host mode. However, one downside is that your NAS will not be able to use AdGuard for DNS, due to the additional security features of Macvlan and its communication with its host. This is generally not an issue unless you wanted to use you AD blocking with Tailscale.
Bridge Mode:
The main benefit of Bridge Mode will be the ease of setup however you will find that all clients on your network will appear under the same IP as the Bridge 172.20.0.1. This won’t impact ad blocking, but it will mean you can’t apply device specific rules etc.
Let’s Begin
In order for you to successfully use this guide you will need to check that your Router allows you to change your network DNS servers, this is usually found in the DHCP settings.
Folder Setup
Let’s start by getting some folders set up for the container to use. Open up File Station create the following.
/docker/projects/adguard-compose
/docker/adguard
/docker/adguard/work
/docker/adguard/conf
Container Manager
Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project then on the right-hand side click ‘Create’.
In the next screen we will set up our General Settings, enter the following:
Section | Setting |
---|---|
Project Name: | adguard |
Path: | /docker/projects/adguard-compose |
Source: | Create docker-compose.yml |
Next we are going to drop in our docker compose configuration, copy all the code in from the appropriate version of the container you want to run below and paste it into line ‘1’ just like the screenshot.
What on earth is a Docker Compose? Docker Compose allows us to define how Docker should set up one or more containers within a single configuration file. This file is yaml formatted and Container Manager uses the Projects feature to manage them.
Please note you will not be able to use Macvlan with a Bonded network connection e.g. ‘Bond0’. You will need to remove the bond in order to use this method.
Host Mode
services:
adguardhome:
image: adguard/adguardhome
container_name: adguardhome-host
volumes:
- /volume1/docker/adguard/conf:/opt/adguardhome/conf
- /volume1/docker/adguard/work:/opt/adguardhome/work
network_mode: host
security_opt:
- no-new-privileges:true
restart: always
Macvlan
services:
adguardhome:
image: adguard/adguardhome
container_name: adguardhome-macvlan
volumes:
- /volume1/docker/adguard/conf:/opt/adguardhome/conf
- /volume1/docker/adguard/work:/opt/adguardhome/work
networks:
macvlan:
ipv4_address: 192.168.0.129
security_opt:
- no-new-privileges:true
restart: always
networks:
macvlan:
name: macvlan
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: "192.168.0.0/24"
ip_range: "192.168.0.254/24"
gateway: "192.168.0.1"
Bridge Mode
services:
adguardhome:
image: adguard/adguardhome
container_name: adguardhome-bridge
volumes:
- /volume1/docker/adguard/conf:/opt/adguardhome/conf
- /volume1/docker/adguard/work:/opt/adguardhome/work
ports:
- 53:53/udp
- 3000:3000/tcp
security_opt:
- no-new-privileges:true
restart: always
If you are setting up the Bridge or Host Mode versions you can now press next and jump ahead in the guide to Web portal settings for Macvlan continue on below.
Settings Amendments for the Macvlan
OK we now need to make some further edits to the compose and sort out DNS for DSM
External DNS for DSM
Containers on a Macvlan cannot be accessed by the host they reside on (without network changes under the hood), this mean DSM cannot use AdGuard for its own DNS requests. It’s better to put DSM on an external DNS provider to avoid it having any issues connecting to the Internet if your AdGuard is down.
Go into the DSM Control Panel > Network and then in the ‘Manually configure DNS server’ set two good quality DNS providers such as Quad9 9.9.9.9
and Cloudflare1.1.1.1
Now you can make some edits to the compose information before moving on
Section | Explanation |
---|---|
Line 10 ipv4_address: 192.168.0.122 | Change to the IP address you want to use for the container. Make sure this is available and not in use by another device on your network. |
Line 20 parent: eth0 | This defines the network interface the container should use, I have used eth0 which will be the first Ethernet port on your NAS. If you want to use a different port change it accordingly. Note! If you have Virtual Machine Manager installed change this to ovs_eth0 |
Line 23 subnet: “192.168.0.0/24” | We need to change this in line with your networks’ subnet – in the example I have used 192.168.0.0/24. The super quick way to work out what to use is just take the IP of your NAS and change the final digit before the /24 to 0 |
Line 24 ip_range: “192.168.0.254/24” | This has to be changed to the highest available IP address within the range of your subnet. Again if your network is in the 192 range the final number used from the subnet above can be changed to 254 and added to this section. |
Line 25 gateway: “192.168.0.1” | This will be the IP address of your Router/Gateway/DHCP Server |
Once you have made the edits you can click ‘Next’
Web portal settings
You do not need to enable anything on the ‘Web portal settings’ screen click ‘Next’ again.
On the final screen click ‘Done’ which will begin the download of the container images and once downloaded they will be launched!
The image will now be downloaded and extracted. You should see ‘Code 0’ when it has finished.
You will now see your AdGuard running and should have a green status on the left-hand side.
You should now be able to access the web interface via
Macvlan = the IP you specified in the compose followed by the port 3000
OR
Bridge or Host = Your NAS IP followed by the port 3000
Initial Setup
You will now do some initial setup steps
Step 1 – click ‘Get Started’
Step 2 – You will be asked to choose the network interfaces AdGuard will listen to for DNS requests and the Web Interface. Leave these set to ‘All Interfaces’ but change the Port for the Web Interface from 80 to 3000.
You will notice the IPs highlighted in Red in the screenshot will be either 127.0.0.1 or 172.20.0.1 do not use these as suggested by the UI as they will not work.
Click ‘Next’
Step 3 – You will be required to set up a Username and Password to access the Web UI. Fill these in (You could follow the Vaultwarden guide to get a password manager setup if you don’t have one already)
Step 4 – Configure your devices
The DNS address to use on your device or router/dhcp server will be
Bridge Mode or Host Mode = IP address of your NAS
MACVLAN Mode = IP address you assigned in the compose file
The addresses shown on the final screen in Red may show different IPs use the one I suggest above.
Click on Open Dashboard and you will be taken to the login screen.
Now log in to your account.
Once your devices start to update with the new DNS server IP you will begin seeing traffic in your Dashboard. (This can take up to 24 hours)
From here you can set up some initial settings such as additional ‘Filters’ (blocklists) or define additional upstream DNS providers who handle the requests that make it past the filters in Settings > DNS Settings.
More settings can be found here
You are ready to roll 🙂
FAQ:
What ports does AdGuard use?
The ports below are used by AdGuard, if you use Bridge Mode above and want to use any of the additional services you will need to add them.
Port | Protocol | Used For |
---|---|---|
53 | TCP/UDP | DNS |
853 | TCP | DNS over TLS |
443 | TCP | HTTPS/DNS over HTTPS |
784 | UDP | DNS over QUIC |
8853 | UDP | DNS over QUIC |
67 | IPv4 UDP | DHCP – Only used when the ipv4 DHCP server is enabled. |
68 | TCP | DHCP – Only used when the ipv4 DHCP server is enabled. |
68 | UDP | DHCP – Only used when the ipv4 DHCP server is enabled. |
547 | IPv6 UDP | DHCP – Only used when the ipv6 DHCP server is enabled. |
3000 | TCP | For the WebUI |
Looking for some help, join our Discord community
If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!
Buy me a beverage!
If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.
Is it just me, or have you skipped the whole part of configing macvlan on the Synology? How do you expect the docker container to communicate via macvlan?
The macvlan is created within the compose, there is no need to set up the macvlan separately, I know some guides do this, but it’s not required. 🙂
Hi, thanks for the guide. I’ve successfully installed on my synology using macvlan route. I can reach the admin page and have it set up. However, when I put my device to use macvlan IP I have no internet.
Hey – Are you adding an individual device or your whole network using the DNS settings on your router? Once you have added a device you may need to disable and re-enable its network connection to force it to begin using AdGuard – you should then start seeing DNS requests in the log.
Managed to get it to work. Instead of individually change the dns on each device I add it to the router DHCP.
Now, I need to figure out how to add a shim so that I can access it through a domain name. Do you have a way for this? Maybe I could implement something like this? > https://stackoverflow.com/a/67835834
That link will help with allowing DSM to access the MACVLAN yes — I have had varying results with getting it to work but well worth a shot!
Thank you (once again) for putting together this guide. I’ve used your guides previously to setup a Plex server on my Synology NAS. I’ve also successfully followed this guide to add AdGuard Home to the same NAS. After completing the guide, I changed my Synology (SRM) router settings to use the IP address provided by AdGuard Home for the “Preferred DNS Server” for the internet connection and the “Primary DNS” for my wireless network. This appears to have correctly directed all traffic to AdGuard Home and filters out ads on my home network.
Since doing that, I’ve discovered that I am no longer able to access my Plex server media outside my home network. Previous to installing AdGuard Home, accessing my Plex server outside my home network worked fine. To troubleshoot the problem, I checked my “Remote Access” settings in Plex and it showed an error that it wasn’t available outside my network. After my poor attempts to fix it by restarting a few things (namely, the AdGuard Home container), I noticed that the Plex remote access page suddenly started saying that it was fully accessible outside my network again. However, the media from my server continues to not show outside my network. Do you happen to have any idea what I’ve done wrong here and how I can correct it? My thanks for any help.
Hey Michael – Could you let me know which version you set up (Bridge/MacVLAN/Host) and then what the IP is that you used for the DNS settings.
Thanks for the reply. I’m using host mode. The DNS I’m using on my router is 192.168.1.64.
OK – good stuff
Leave the router as is as its clearly working. However, try changing the NAS itself to use a manually configured DNS – have a look at the MACVLAN section on how to set two DNS providers and see if Plex then gets connected. It would be odd that Adguards default providers would be blocking Plex.
Sorry for not following. I’m still fairly new to all of this. Are you saying to change from host mode to macvlan mode? Unfortunately I can’t do that, since I have a bonded network.
Otherwise, if that’s not what you’re suggesting, would you mind elaborating? Do you mean I should change my preferred DNS server in my DSM settings? If so, what should I change it to? Also, I didn’t see anything regarding two DNS providers in the macvlan section (unless I’m missing it). Thanks!
Oh, sorry I could have sworn I had extra information about that – bear with me while I update it won’t be long!
OK at some point I added the information to the PiHole guide but not this one, sometimes I feel like I am going mad as could have sworn I had the info in sync!
OK I have updated the guide with the missing section very strange I think my WordPress install is haunted!
Do the steps from the section titled ‘External DNS for DSM’ now this shouldn’t normally be required for host mode – but see if it helps you. Failing that I would try doing a reboot of the NAS as it could just be some kind of temporary network issue.
Thanks so much for the guide updates and advice! It’s funny; I must have rebooted my router a dozen times, but never though to reboot my NAS. Looks like that simple task may have fixed my problems. If they crop back up again, I’ll try the manual DNS trick you mentioned. Thanks!
Hi! All your guides have been INCREDIBLY useful to my entire setup. One question, if I already set up the macvlan network, and would like to now use Virtual Machine Manager, how would I go about changing it to ovs_eth0 from eth0?
Hi
So it’s as simple as installing VMM then stopping the AdGuard container project, and just edit the compose with the newly named port, then fire it all back up.
THanks for the guide, I used the macvlan setup.. should i make an IP address on my main vlan or can it be on its own vlan?
As long as your other clients can reach it for DNS then either.