Ok, first of all full disclosure: I'm the author of an app which is now on the Google Play Store and which makes you able to change DNS for any mobile connection on Android 4.4. The app requires root, costs a couple of bucks and is called Override DNS.
I was told, on a now deleted answer, that is fair to link to my app as long as I expose it clearly.
I did not find a way to reliably do it without an app.
I often use OpenDNS Family Shield, but sometimes it blocks me to visit some particular hacking site and then I need to quickly and easily change the DNS servers.
I used to use Set DNS but it stopped to work in Android 4.3 and further, so I created Override DNS, a new app which mimics Set DNS' behaviour,...
I "solved" this problem by using an iptables rule to forward all port 53 connections to an intended DNS server; my experience on Android 4.4.2 with attempting to modify DNS settings while connected to 3G has been exactly as Leo described; ignorance of values in getprop |grep dns[0-9]\]: and dhcpd.conf.
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --...
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 ...
Pardon me if I fail to sum up the vast subject in a brief answer :)
SELINUX AND AVC DENIALS
Android is based on Linux kernel that makes use of Discretionary and Mandatory Access Controls (DAC, MAC) to restrict access to system resources such as files on a certain filesystem. DAC includes classic UNIX RWX file modes, owner/group or UID/GID, Extended ...
I ended up manually changing my DNS server to tether Internet from my mobile phone. My phone uses a local DNS server from my mobile carrier which I was able to trace using CompruebaIP.
Any other DNS server is blocked by my mobile carrier (Globe Telecom). I reckon that my phone's DNS service is not properly working. When tethering, the DNS provider should be ...
Regardless whether you're connected to your local network via WiFi and DHCP is in use, Android always seems to override its DNS entries using Google's servers. It's somewhat hidden, but easy to change – provided you have your own DNS running (a lot of routers offer that already).
To do so, go to your list of WiFi networks in Settings, long-press your WiFi's ...
You can solve this issue either from the Android side or from the Windows side:
From the Android side
Tap your device "menu" button, and select "settings";
Tap "Wireless & networks";
Tap "Wi-Fi settings";
Tap your device "menu" to bring up extra options and select "advanced";
Tap "Use ...
You cannot simply edit the hosts file on Android, as it resides on a read-only file system: /system/etc/hosts, see:
How to edit etc/hosts file
How to change the hosts file on android
use a DNS server like DNSMasq in your local network to take care for that "centrally"
use "root powers" to force-edit the system file as described above
There're also apps like Internet Booster promising to "clear DNS cache" (amongst other things). I didn't try it out myself, and furthermore there seems no way to do only that (just one "optimize" button which "applies improvements"); also its effects might differ between devices (says the app's description) -- but it might be better than a reboot. Btw: while ...
While the setprop method to change DNS does not work, the getprop method to read those values should be still valid today:
shell@A0001:/ $ getprop | grep dns
We recently encountered this issue, and we narrowed it to occurring ONLY on devices running Android v5 and newer. Android v4 and all other OS's have no issue.
With that tidbit, we determined that Android v5 and newer insists on using IPv6 for DNS name resolution. (Since we've completely disabled IPv6 on our network, this jibes with the issue.) If Android ...
This is really a continuation of @Zuul's answer, to cover the DNS settings in Android 4.0+ (ICS), which is a little harder to find IMO. AFAIK Zuul's answer covers Android <2.3 settings.
From the Android side (Android 4.0+ ICS)
WiFi (click on word "WiFi", not ON/OFF switch)
Press and hold (long tap) your wireless network until dialog pops up
First, without DNS the network connection won't be much helpful to you: you will need DNS to resolve host names to IPs – or entering something like www.google.com into the browser's address bar will just give you an error.
Which does not mean you cannot use a DNS server other than Google's.
From your homescreen:
Press the Menu key, select Settings
Go to ...
I am leaving my old answer since the browse and parsing examples may still be useful for some people.
Thanks to the developer's version 5.5 update to SSHelper, you can create a user defined name to be the phones Zeroconf instance name. SSHelper will run the SSH server on a non-rooted Android.
Update SSHelper to version 5.5
Open Android Bluetooth settings ...
In the March 2014 update to SSHelper the documentation states new changes to it's Zeroconf broadcasting name. In the documentation Configuration section of the details it describes the checkbox to "Enable Zeroconf broadcasting". When this is enabled any other client on the local network, will be able to browse and then connect for SSHelper on the network.
I have been using the free SSHelper (without rooting) since it recently added zeroConf broadcasting. It provides an SSH and RSYNC (file transfer) server, while also broadcasting a ZeroConf name. Another avahi/bonjour client can connect without needing to know the android hostname. Explained in more detail in this other answer: Set hostname for SSHelper
Currently there is no Avahi daemon on Android and open ticket #354 at Avahi tracker, where there are attached patches, needs to be addressed to make a build for Android possible.
You can try to build it manually, if really needed.
This info is from 2014. But it might still work. I am not in the position to test it at the moment, but since you are rooted. You could try adding the dns settings to the build.prop file and see if it sticks. Adding the following to the build.prop file should add google as your DNS server.
OK just found it. In wifi settings press and hold the connected network you want to set IP to. Pick modify network and in there you scroll down, to DHCP settings and pick static and scroll down to et your IP. Kinda complicated comparing to non sense android. O well. Hope that helps OP or any other fellow searcher.
ICS has issues on some devices with Wireless-N. My Acer A500 works properly, but my 2 Xperia phones kill my router instantly if I use the N-draft protocol.
So, try deactivating N-draft mode in your Android device or your router, then it sohuld work.
I have yet to find a way to create a hostname for an Android device. What I have done is that I set an IP reservation for my phone, so that every time I go to use SSH (I use QuickSSHd, but it should work for SSHelper) you can at least point to the same IP address.
There is no way to set a host name for the phone, that I have found.
OK, I know I'm way late, but here's an alternative I'd like to share that may be of help.
Just open your browser at
https://email:email@example.com/nic/update?hostname=your_opendns_network_label to update your IP -- and that's it. On the email part, use "%40" as an @ and "%2E" as a dot, ie, write "someone%40somewhere%2Ecom" instead of "someone@...
The solution is further down the same page:
I had a problem flashing the zip (made by qwerty12) in the link so you may need to extract the contents to the relevant directories (in /system) and make sure they have the correct permissions. I used Fx explorer for this. You obviously ...
As mentioned by lzzy, you can use DNSMasq server to achieve this. But Chrome uses own DNS resolving process and this method may not work.
To start the server use the following command:
sudo /usr/local/sbin/dnsmasq -d \