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

As you can see, my phone uses and 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 (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?

1 Answer 1


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.

  • Great answser, thanks. However, getprop | grep dns doesn't return anything. getprop | grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}' (looking for IPv4 address) doesn't return relevant result. Returned properties are ro.baseband, ro.build.description, ro.modversion and gsm.version.baseband. Any idea? Commented Oct 23, 2012 at 20:16
  • @Morgan: I suppose it might be some kind of difference between CM7 (you're running) and CM10 (what I tested on). What happens if you don't grep the output at all? Do you see anything relevant? (might want to pipe it into more or similar since it could be lengthy) Commented Oct 23, 2012 at 20:43
  • 1
    @Morgan: I don't have a Gingerbread device onhand to test, but there should be a way to do it in the standard wireless settings if you configure a static IP (I don't think you can do it this way if you use DHCP, unfortunately). On JB I long-press the network I'm connected to and select "Modify" to get to it. It may be under the "Advanced setttings" though (menu button when on the list of wifi networks). You can also use setprop but it won't persist across reboots/disconnects. For example. setprop net.rmnet0.dns1 <your DNS IP> should change the value of the net.rmnet0.dns1 property. Commented Oct 24, 2012 at 15:49
  • 1
    And I think the more specific one would be used by the adapter (net.rmnet0.dns1 in your case), though it may be inheriting that value from the more generic net.dns1 property. Commented Oct 24, 2012 at 15:50
  • 1
    @Rhyuk: I don't know. setprop might be a temporary solution if you gave it blank values, but you'd have to run it on every boot (and I'm not sure if that would actually work). Commented Mar 23, 2015 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .