Local DNS settings overwritten when enabling WiFi

Hello everybody. I am using Mac OS X 10.8 to connected to two networks through ethernet and wifi and I am experiencing a problem with local DNS resolution. I would really appreciate your advice.


I am simultaneously connected to two networks. A local network through ethernet (eth) and to the internet through my company's wireless AP (wifi). I would like to be able to query by name my local computers (like ping computer1) but also I would like to have internet connection through wifi.


In the Network Preferences I have the following priority:

First ethernet and then wifi.


By doing so, it works correctly when I ping local computers by IP. i.e. ping 192.168.1.1 works and I can access the internet as well. DNS settings for each interface are listed correctly in the Network Preferences settings. i.e. DNS for eth is 192.168.1.1 and search domain mydomain.com. For the wifi, DNS are also listed correctly with the settings my company provides.


However, when wifi is enabled I do not succeed in resolving names with the local DNS server. If I disable wifi, local DNS works fine. I have found that the resolv.conf file is overwritten when I enable wifiand therefore local DNS server is not contacted, instead my company's DNS is contacted. To be more specific, when wifi is enabled, the resolv.conf file holds only DNS information provided by my company (even though I prioritised it second position in Network Preferences ):


So when WiFi is enable, resolv.conf has the following:

domain my.work.domain.com
nameserver x.x.x.x
nameserver y.y.y.y
nameserver z.z.z.z


When WiFi is disabled, resolv.conf has the following:


domain mydomain.com.

nameserver 192.168.1.1



Similar issues appears when using scutil --dns.


When I have BOTH eth and wifi enabled, using scutil --dns, I get the following:

DNS configuration


resolver #1

search domain[0] : my.work.domain.com

nameserver[0] : x.x.x.x

nameserver[1] : y.y.y.y

nameserver[2] : z.z.z.z

if_index : 4 (en0)

reach : Reachable


(Here are listed but removed by me the rest of DNS resolvers #2 - #7 that normally Mac users have for internet )


DNS configuration (for scoped queries)

resolver #1

search domain[0] : mydomain.com

nameserver[0] : 192.168.1.1

if_index : 6 (en2)

flags : Scoped

reach : Reachable,Directly Reachable Address


resolver #2

search domain[0] : my.work.domain.com

nameserver[0] : x.x.x.x

nameserver[1] : y.y.y.y

nameserver[2] : z.z.z.z

if_index : 4 (en0)

flags : Scoped

reach : Reachable



When I disable WiFi and only keep ethernet, using scutil --dns, I get the following:

DNS configuration


resolver #1

search domain[0] : mydomain.com

nameserver[0] : 192.168.1.1

if_index : 6 (en2)

reach : Reachable,Directly Reachable Address


(Here are the same as above resolvers #2 - #7 that normally Mac users have for internet )


DNS configuration (for scoped queries)

resolver #1

search domain[0] : mydomain.com

nameserver[0] : 192.168.1.1

if_index : 6 (en2)

flags : Scoped

reach : Reachable,Directly Reachable Address



Thank you for reading 🙂

Posted on Jul 3, 2013 5:10 AM

Reply
4 replies

Jul 3, 2013 12:27 PM in response to Linc Davis

Thank you for your answer ! I like the tip about setting my local DNS server as primary in my WIFi settings. I will try to do that tomorrow monring as I am back home now. I just hope this can ammended by me in the Settings even when the default DNS settings are set through the DHCP of my company that I do not control. I did a trial in my home WiFi AP and seems to work.


However I still do not understand why even if the default (highest) route is the ethernet, when WiFI is enabled (set lower than ethernet) the DNS settings set from the ethernet are overwritten by the ones set by WiFi. OS X should repspect the priority that I am setting and not overwrite the DNS settings from a secondary route. I wonder whether it could be a misconfiguration on my part (i.e. the local DNS server).


I will confirm my findings tomorrow. Thank you

Jul 4, 2013 4:28 AM in response to Costas K

I would like to confirm that manually setting my local DNS server as primary in my WIFi settings circumvents the issue of not contacting the local DNS server. So the problem is pacticaly solved.


But, I still do not understand why even if the default route is the ethernet, when WiFI is enabled (set lower than ethernet) the DNS settings are overwritten by the ones set by WiFi.

Jul 5, 2013 5:10 AM in response to Costas K

I have just checked connecting with a Linux box on those two networks I described above (local through ethernet and to Internet through WiFi) and there is no problem. Automatically the resolv.conf file is APPENDED rather than overwritten by the setting of the WiFi connection. So I assume this is a bug of OS X because I observe a normall behaviour on Linux. The above solution to the problem (manually modifying the DNS of the WiFi) is not ideal because I could connect through ethernet to a different local subnetwork where the local DNS is not 192.168.1.1 and in that case the DNS setting would require further manual changes. But for the short time this tip helped me a lot.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Local DNS settings overwritten when enabling WiFi

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.