Is it possible to use different DNS servers based on the ip or the requested hostname?
- for www.example.com the 22.214.171.124 DNS server should be used
- for any other request the 192.168.1.1 DNS server
Thank you! :)
You could set up your Mac as local DNS forwarder. You have to install bind, configure as your local DNS and configure named.conf (/etc/named.conf).
The other hacky way, which I haven't tested is:
When you having two DNS servers in you /etc/resolve.conf, Mac should decide which DNS is best for you to use based on the routing (I think).
You should assign your Mac into two different networks. The best is to have two connections (LAN+WiFi) or two LAN connections, or at least two gateways, but you could try with one (which will be more complex).
This example is based on one. Basically create two networks like:
and then try to re-route your DNS servers and domains to specified interfaces.
I don't know if this hacky way will work on one interface, but should work on two.
If you have two gateways (even if it's the same device), more probability it'll work.
If this method doesn't work, sorry (let me know). It should be improved based on some practical go-through.