Dnsmasq with a black list is very powerful for that matter. AlgoVPN [1] is using it, and provides a network-wide ad blocking and anti-tracking.
Also, I made an app which is a distributed version of AlgoVPN, for iOS devices. People testing it find it very convenient.