I would like to configure adblock to only be available to certain devices in my network (f.e. Smart TV).
How can I do this?
My idea was to bind adblock to a 2nd dns server (192.168.1.x) on my x86 router and tell all clients, on which I would like to use adblock, to use the 192.168.1.x DNS server instead of my routers main ip (192.168.1.1).
Usually it would be easier to put the affected devices (especially for larger numbers) into their own subnet/ vlan, with their own dnsmasq instance (you can configure this via /etc/config/dhcp), but your approach is also possible (dnsmasq allows overriding dhcp options for selected MAC addresses).
But wouldn't the first option make the NAS / DLNA server running on my owrt router unavailable?
Wouldn't this also block streaming from my smartphones to my smart tv?
I took a look and the adblock script runs using dnsmasq. So you could create a virtual net device, attach it to a vlan and set dnsmasq to only run on that virtual net device. You then connect the devices you want to adblock using a static network config specific to the vlan you created and after all that it could work.
What would be simpler would be to use privoxy and manually set the privoxy address and port as the network proxy in the TV's network settings, if it will let you.
Even easier. Just block everything or set up two connected routers. One that blocks. One that does not.
There is no law that says the nameserver must be on the same subnet.
Create an extra interface on the router..... the clients that need to get to that "outside" dns are set so in dhcp. Everyone one on the same subnet.... just a few "reaching out" for their dns....
The only hiccups are the settings in that dnsmasq instance that tell it to only accept requests from that lan.
And maybe if want to be be exact, a firewall rule or two.... This method cuts down on any issues with routing... and losing your NAS or whatever.....
config redirect
option name 'AGH-DNS_SAMSUNG-TV'
option target 'DNAT'
list proto 'tcp'
list proto 'udp'
option src 'lan'
option src_ip '192.168.0.60'
option src_dport '53'
option dest 'lan'
option dest_ip '192.168.0.1' # ip on which adguardhome is listening
option dest_port '65353' # port on which adguardhome is listening