Background
I had a problem loading images from a particular website. ( more details of that here)
Someone at work Suggested I change my DNS servers to openDNS and see if that resolves the problem.
As they thought it may be that the DNS server from my provider is what was slowing down the page/image loads due to the cross domain calls with its javascript.
It turns out that this was indeed the case. The images loaded as expect with the new DNS servers ( google 8.8.8.8 and 8.8.4.4)
Changing back the Problem reoccurs.
But I do not really want to change my DNS servers. Especially for just one site.
Question
Is there any way I can use my normal DNS server addresses. But have a proxy (PAC file) that redirects to an alternate DNS server when this web domain (cultofma.com) is used.
Best Answer
You can specify the DNS servers that will be used for specific domains, but AFAIK this requires you to run BIND (
named
) on your machine. In this situation, your computer would be running anamed
process, and will have its configuration file setup to forward DNS requests for most queries to your ISP (i.e., the DNS servers that you were using before Google's Open DNS). This also allows you to specify domains in which you'd like the 'alternative' DNS server to be queried. Once you've gotnamed
up and running, you could then configure System Preferences to use your loopback address (127.0.0.1) for DNS lookups. The/etc/named.conf
file for this configuration (based on Apple's defaultnamed.conf
) would look something like:Configuring
named
Before starting
named
, it may be necessary to generate the rndc key that's being used for rndc control:Note: the only portion of the default
/etc/named.conf
file that was modified above is the line in "options" that specifies the forwarder DNS servers (the ones that will answer most of your queries), as well as a zone entry for the "special" zone that you'd like to perform split horizon lookups for.In this example, all queries are forwarded to the DNS servers 8.8.8.8 and 8.8.4.4 (Google Open DNS) with the exception of queries for records in the "test.example.com" domain (which are forwarded to 10.0.0.5 and 10.0.0.6).
Forwarder options
Zone to forward
Test your local
named
configurationNext, you can test your
named
installation by running it in the foreground (before committing to the setup):In another Terminal window, query your local DNS server to confirm that it is working:
Make sure that your "special" forwarding zone is being utilized:
Setup named process to start at boot
Once you see that the lookups are working as expected, you can kill the
named
process that's running in the foreground of the first Terminal window by issuing an interrupt using the "Control"+"C" key command (^C
).It's possible to start the DNS server every time the machine boots by enabling the launch daemon job for that process:
Lastly, you'd configure that the local machine's loopback address be used as the DNS server in System Preferences -> Network.
How to remove configuration and setup
This setup could potentially cause network problems (if not configured correctly). Here are some instructions on how to undo this setup:
1.) Remove the DNS server (127.0.0.1) from the network interface that you configured in System Preferences.
2.) Disable the
launchd
job that causesnamed
to start on boot: