For those of us the roam around on network connections, [OpenDNS](http://www.opendns.com) and [Google Public DNS](http://code.google.com/speed/public-dns/) provide public DNS servers which offer better security than using arbitrary DNS that’s assigned to us when we connect to a network. This means that rather than trusting the assigned DNS server — which could be a malicious third party that’s attempting a man-in-the-middle attack — we always use a trusted server.
In OS X, normally, one can specify custom DNS servers in Network Preferences, but when using Internet Tethering with the iPhone, no options are available.
It’s possible to set DNS configuration on the command line, though, as mentioned in [this MacOSXHints article](http://www.macosxhints.com/article.php?story=20050621051643993).
This technique can be used within a [shell script](http://stackoverflow.org/wiki/Set_the_DNS_server_under_OS_X) to make things easier.
As it happens, if you have a jailbroken iPhone, the trick works there too — just ssh
in as root, copy the script over, and run it from the iPhone.
The one caveat is that the DHCP client both on the iPhone and on Mac OS X will routinely reset the servers — I haven’t found a way to combat this yet, other than routinely re-running the script.
We have been using mobile broadband from my iPhone while we’ve been [travelling](http://michael.tyson.id.au/about); our current [provider](http://michael.tyson.id.au/dk2oa) seems to go offline almost every evening — a quirk which I’ve just discovered is related to their faulty DNS server.
Using Google’s public DNS servers instead fixes this problem, so I was after a way to configure both the iPhone and OS X to use the servers.
I try to follow the instructions but terminal says: “mobile is not in the sudoers file. Thiis incident will be reported”..
Do you know how to fix this? I was in the first step of this:
sudo scutil
You’ll either want to add ‘mobile’ to the sudoers file using visudo (google is your friend), or do it as root.
Thanks this is kickass