Companies like OpenDNS and Google offer up alternative DNS resolution servers that you can use for free. Over-simplified, that means that those companies provide a mechanism by which your computer (or router, or other Internet-connected device) can look up the specific IP addresses of the domain names (e.g., “lexfriedman.com”) that you try to visit.
You don’t need third-party DNS servers; your ISP provides its own. But third-party DNS solutions offer nice perks: They’re often faster than your ISPs servers, speeding up your visit to every single website, every single day. But they can also provide other clever features. OpenDNS, for example, offers parental controls, typo correct (type in a “.cm” domain that doesn’t exist, and get automatically forwarded to the “.com” URL instead), statistics, and more.
One problem with third-party DNS options, however, is that they prevent services like Netflix and iTunes from offering up their top speeds. Such services try to stream your bandwidth-hungry content from the closest servers to you; since Google and OpenDNS block those services’ ability to figure out where you are, you miss out on the speed benefit of being physically closer to the servers in question.
There’s a solution. You want your Mac to use Google or OpenDNS for most websites, but to use your local ISP’s DNS when you visit sites like Netflix. Configuring custom DNS servers for specific websites is doable. I’ll explain how. But first, I’ll explain why I actually care.
Why I care about the solution: The NFL
I root for the Philadelphia Eagles, but I live in the New York market. Any time the Giants and Eagles play at the same time (but not against each other), I miss out on the opportunity to watch the Eagles play. (Sometimes, a Philadelphia station that our cable company offers in standard definition only carries games—the HD broadcast, cut off on both sides, not letterboxed. It’s not always offered, and it’s a terrible way to watch.)
Third-party services like AdFree Time offer up a DNS-based solution: Pay a monthly fee and use their DNS services, and the NFL’s website treats you as if you’re coming from Europe. You thus get to watch every NFL game streaming online in high definition, since the league offers that option to folks in Europe at no charge. Americans, usually, miss out. I could pay for DirecTV’s insanely overpriced Sunday Ticket, but I think it’s a ripoff when I’m only looking to watch about six to eight Eagles games that won’t show here.
And if you’re wondering whether AdFree Time and similar services are legal, perhaps this scholarly legal document will provide the reassurance you crave.
AdFree Time works beautifully, for $2 a month. I can watch Eagles games that I’d otherwise miss. But the problem is, for reasons I can’t quite explain, using the service’s DNS breaks some unrelated sites for me. (The CSS on Feedbin fails to load, for example.) And it’s also a little weird to think that a small, foreign company could monitor every website I visit, NSA style.
So I needed to research how to use custom DNS servers for specific websites to make AdFree Time work for my purposes.
How to do it
As explained by OS X Hints, you can use custom DNS servers for specific domains by creating simple text files. Create a directory called resolver in the
/etc/ folder. (You’ll need to do this as root.)
I created a file called
gamepass.nfl.com. Inside that file, I pasted a couple lines of text:
(I made those IP addresses up. In reality, this is where you’d put the DNS servers of your third-party provider.)
That’s the only step. Immediately, when you go to visit the domain in question, your Mac will use the custom nameservers you provided in those text files.
To test this yourself without an AdFree Time subscription, you can use OpenDNS’s servers just for OpenDNS’s website. Create a file called
/etc/resolver/opendns.com, and paste in OpenDNS’s servers:
Now, when you visit opendns.com/welcome, you should see a checkmark and a message indicating that you’re using OpenDNS’s servers—even though at this moment, you’re only using them for that specific domain.
If you use OpenDNS or Google Public DNS systemwide, and Netflix streams more slowly than you’d prefer, you could instead create entries like netflix.com, and use your local ISP’s nameservers just for those domains.
And as for me, now I’m not just ready for some football: I’m able to watch it, too.