Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Hack5190

macrumors 6502a
Original poster
Oct 21, 2015
531
311
(UTC-05:00) Cuba
Often I use OpenVPN on both my PPC and Intel (Sierra) Mac's. Sierra doesn't suffer from DNS leaks but the PPC does.

The easiest way to address this is to change your DNS server setting before starting the VPN connection.

You can do this via the network settings GUI or via a pre-configured script. Personally I created two scripts - "PRE" to set specific DNS servers and "POST" to reset the DNS servers. (Use the same code used for both, just change the DNS server IPs)

Here are code examples for the command line
Code:
#! /bin/sh
dscacheutil -flushcache
networksetup -setdnsservers AirPort (IP address DNS #1) (IP address DNS #2)

and AppleScript
Code:
do shell script "dscacheutil -flushcache"
do shell script "networksetup -setdnsservers AirPort (IP address DNS #1) (IP address DNS #2)" with administrator privileges

A list of Public DNS Servers is available here http://public-dns.info/ (I'd recommend using servers from a mix of different countries)

To confirm (display) the current DNS server setting
Code:
#! /bin/sh
networksetup -getdnsservers AirPort

Tools to test for DNS Leaks - http://dnsleak.com/ and https://www.dnsleaktest.com/

Enjoy, surf safe and try to avoid the Five Eyes ;)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.