I have a network with a policy where some clients have to use openDNS for page filtering and some are allowed any DNS (e.g. Google DNS). I am using Squid in transparent mode for all connections to the internet. Squid allows defining dns_nameservers for all requests, but is there a way to define different DNS servers based on the client's IP? Or is there any sensible way outside of Squid to force some clients to use openDNS and some use say Google DNS without touching much the client configuration? I have limited access to some clients.
See Per-client DNS servers with DNSMasq for an already answered question (or mark as duplicate, since the dnsmasq answer doesn't really has to do anything with squid.)
Using dnsmasq as DHCP-server, set specific ranges for different clients, for example:
dhcp-host=00:00:00:00:00:01,set:DNS1,192.168.0.1 dhcp-host=00:00:00:00:00:02,set:DNS1,192.168.0.2 dhcp-host=00:00:00:00:01:01,set:DNS2,192.168.0.11 dhcp-host=00:00:00:00:01:02,set:DNS2,192.168.0.12 dhcp-option=tag:DNS1,option:dns-server,126.96.36.199 dhcp-option=tag:DNS2,option:dns-server,188.8.131.52