DNS Issues

April 12, 2017

This one was driving me nuts, but I finally figured it out.

So I use OpenVPN Access Server to stay connected back to my home network, this allows me to use all my local network resources from wherever I am.

I set it up so that I get access to my local network but don't route traffic through there, this is useful for example at work where we have a very good internet connection and VPN would actually throttle me by a lot.

Now I was getting some weird behaviour on my computer, most noticeable with Safari where it would take serveral seconds to start loading a website, after that initial delay then everything would load pretty fast. A quick search pointed me to what I already thought was the problem some sort of DNS Resolution issue, so I decided to try out Googles DNS and OpenDNS servers.

OpenDNS has a nice test page that tells you if you're actually using them or not by going here OpenDNS Welcome, and me being lazy, instead of checking first my /etc/resolv.conf I was just loading that page, and maybe you guessed it, it wasn't working. And I went around in circles trying to figure out what was wrong, (still ignoring the resolv.conf file).

Tried everything rebooted the computer, and nothing. So then I thought maybe it's my OpenVPN client, so I turned it off, and still nothing, rebooted the computer again and still nothing.

Finally I went to check the /etc/resolv.conf file only to find out that it was set to use the routers DNS:

# Mac OS X Notice
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
# This file is automatically generated.

This made no sense to me as my Network Settings on macOS were set to use the OpenDNS nameservers.

What I came to find out is that OpenVPN which was set to start at boot and connect, was overriding the settings and using my home connection as the DNS provider, and when I turned it off instead of reverting to whatever macOS was configured to, it would just set it to the network router.

What I had to do to "fix" it was after I turned off OpenVPN to turn off and on the Wifi Connection in my case or if I was wired to unplug and plug the cable back in.

Need to look into my settings to make sure this doesn't happen again.

Posted: Apr 12, 2017