How to set DNS Server on Android Phone

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 8.8.8.8" > /system/etc/resolv.conf
echo "nameserver 8.8.4.4" > /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 208.67.222.222 and 208.67.220.220 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 8.8.4.4 [enter]
        nameserver 8.8.8.8 [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! 😀

Advertisements

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

  1. 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. 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?

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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