Wednesday, August 23, 2017

cyanogenmod - Why does my phone use Google Public DNS?


I was just curious to know what DNS server my phone used. So I launched a terminal emulator and I entered:



$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

As you can see, my phone uses 8.8.8.8 and 8.8.4.4 as DNS servers (Google Public DNS servers).


At home (Wifi), my router is configured to give OpenDNS' servers through DHCP. But, on my phone, cat /etc/resolv.conf returns the same output. Same thing with 3G. And, even if I disable both Wifi and 3G, and then reboot the phone, it still uses Google's Public DNS servers.


I don't remember having changed resolv.conf or installed any application to change it.


My phone is an HTC Desire with CyanogenMod 7.2.0.1 (Android 2.3.7).


Can someone explain me why my phone uses Google Public DNS? Is it a common configuration for any Android devices, or CyanogenMod ROM?



Answer




According to Steve Kondik, this is essentially old code that is leftover from older versions of CyanogenMod:



This was only here for apps that were statically linked against uclibc in old CM versions. It can likely just be removed.



However, he also goes on to note:



Also, this file is NOT written when connecting to a network as /system is readonly. The actual DNS servers are read from system properties.


I also just verified that the DHCP supplied servers are actually being used, so this issue is invalid unless someone proves otherwise.



So the values in /etc/resolv.conf actually don't reflect your DNS settings. What you can do instead is use getprop to find your DNS values. You can pare it down rather nicely if you grep the output like so:



getprop | grep dns

Also worth noting: the /etc/resolv.conf file appears to have been removed completely in later versions of CyanogenMod. I don't have one on CM10 at all, but getprop does correctly show my DNS settings.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...