steventblack / ad-blocker

Simple ad-blocker for Synology devices
54 stars 14 forks source link

Stupid question but do I have to set my DNS to the IP of the NAS? #8

Open jayheavner opened 4 years ago

jayheavner commented 4 years ago

Right now my gateway 192.168.1.1 has DNS set to 1.1.1.1. Do I need to change that to point to the IP of my NAS to get this to work?

sgreadly commented 4 years ago

Yes, you need to point your gateway (and/or hosts) to the Synology's DNS Server. So if your Synology is say 192.168.1.2, then set the gateway's DNS to that, as well as your hosts if you have any statically configured. Same with DHCP server configuration on the gateway (or if you use Synology DHCP).

Think of your Synology as the main point of contact for all your DNS requests from your local hosts. It will then block said requests or forward them to the outside world as necessary.

hwinnemo commented 2 years ago

I guess I have a similar question. Or rather, would like a clarification on the same question. Here is my current setup:

Is the above A) as it should be; and B) a correct understanding of what should happen?

Furthermore, if the above is correct, I can see two ways to run this system:

1) Per device config

Each device configures its network settings to point to the Synology (192.168.2.100) as its primary DNS server. Advantage: Per-device flexibility. Disadvantage: Hassle to configure each device.

2) Gateway config

I would configure the gateway (192.168.2.1) to actually use the Synology (192.168.2.100) as the DNS. Since the Synology is by default configured to use the gateway as a DNS (creating an infinite loop), I would then have to configure the Synology to use the external DNS (e.g. 1.1.1.1) instead. So a DNS query would be resolved like this: Device > Gateway > Synology > 1.1.1.1). Advantage: No per-device hassle. Disadvantage: None really. If a device wanted to opt out of the Gateway > Synology redirection, it could always just configure its desired (external) DNS independently.

Let me know if I misunderstood anything. And if not, what the issue could be with the above not working on my system (currently, I have the simpler Per device config set up, as this requires the least modifications to the original system)

hwinnemo commented 2 years ago

Update

It turns out that my proposed configuration actually does work, but the one change I had to make (which doesn't seem to have been noted elsewhere) is that I had to go into the DNS Server applet on the Synology and under Resolution check Enable resolution service. From my (limited) understanding, this is what actually enables the "bridge" between Synology and the Gateway. Meaning that if the Synology doesn't have the actual answer for a DNS query, it can now forward it to its own configured DNS server (such as the Gateway or an external DNS). That was the missing link that previously didn't seem to work. Since this wasn't enabled by default (at least on my system) and is a necessary step to get the instructions to work, maybe it should be included, at least as a "check that this is enabled" bullet point.

Having said that, thanks so much for maintaining this repo. I looked at various solutions for this issue and using my existing Synology definitely seemed like the most elegant one :)