How to set DNS Server on Android Phone

19 Oct

I was wondering how to set DNS server on my Android Phone’s Network. Now, i found it, it’s simple just like we set DNS Server on Linux. You’ve got to choose your fav. DNS, (i think there’s 2 best : Google DNS and OpenDNS), so it’s your choice 🙂 Ok, if you already have resolv.conf before on your /system/etc/, we just need to set DNS server that you like..

echo "nameserver" > /system/etc/resolv.conf
echo "nameserver" > /system/etc/resolv.conf

On that example above, i set DNS Server for Google DNS. But, if you like to set Open DNS, you should change the IP address to and and what if there’s no resolv.conf on my /system/etc? 😀 Ok, here we go..for 1st step, we need to make a file “resolv.conf” on /system/etc on your Android OS. Maybe you could use ADB shell, i think. 🙂

        adb shell [enter]
	su [enter]
        mount -o remount, rw /system [enter]
	cat > /system/etc/resolv.conf [enter]
        nameserver [enter]
        nameserver [enter]
        exit [enter]

Stay on adb shell command line, At last, we just need to set permissions “resolv.conf” to rw-r–r–, just type this command :

chmod 644 /system/etc/resolv.conf [enter]
reboot [enter]

done..your phone will reboot automatically.. goodluck! 😀


Posted by on October 19, 2011 in Android


Tags: , , , , , , , , , ,

16 responses to “How to set DNS Server on Android Phone

  1. Jeffrey B

    November 6, 2011 at 7:06 pm

    Awesome! Thanks for the info!

    I think these prices can vary, but it is always more expensive to import it from the US.

    Personally my limit is $600, but that is just me.

  2. sule

    November 24, 2011 at 2:51 am

    mas kalau blum jd ngeroot, masih bs d setting kah..?

    • WdYz

      November 24, 2011 at 6:08 pm

      tidak bisa, mas. Mesti root dulu 😀

  3. John

    April 25, 2012 at 4:35 pm

    The second echo statement should have a double “>>”, not a “>”.

    • WdYz

      April 30, 2012 at 2:16 pm

      Thanks, sir.

  4. Steve

    August 15, 2012 at 2:56 am

    The 4755 should read 644

    • WdYz

      September 14, 2012 at 4:20 am

      thanks 🙂

  5. Vulka

    December 1, 2012 at 6:10 am

    Well, have you never tried the command “exit” (no quotes) instead of Ctrl+C ? This is correct

    • WdNk

      May 26, 2014 at 2:52 am

      Thank you for your correction 🙂 i have edited my article above. 🙂 just check it out. 🙂

  6. ropo

    February 12, 2013 at 11:21 pm

    Hmmm, did not work for me. Also I would prefer to use the DNS server provided by DHCP

    • WdNk

      May 26, 2014 at 2:53 am

      Sorry, it’s my fault. I’ve just edited my article above. Thanks.


    February 14, 2013 at 5:54 am

    This is certainly the 4th article, of urs I really read through.
    And yet I enjoy this particular 1, “How to set DNS Server on Android Phone
    butterflydroid” the very best. Take care -Lorri

  8. Adil ALPMAN

    May 25, 2014 at 6:56 pm

    You said set 4755 to chmod /system/etc/resolv.conf but it make;

    root@codina:/ # ls -al /system/etc/resolv.conf
    ls -al /system/etc/resolv.conf
    -rwsr-xr-x root root 38 2014-05-25 14:48 resolv.conf

    but u show different privileges in this line below;

    At last, we just need to set permissions “resolv.conf” to rw-r–r–, just type this command :

    and it needs chmod 644, not 4755 which one is right?

    • WdNk

      May 26, 2014 at 2:45 am

      Sorry, it’s my fault.. Just changes a permission to 644 rw-r–r–
      Thank you for your corrections.

  9. zfallinlove

    September 29, 2014 at 9:24 pm

    if i write adb shell it said to me device not found


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: