改变查看修改安卓手机的DNS

This post is a continuation to my previous post on “[How to] Change DNS Server on Android phones?”. The earlier post was about changing the DNS Server when you are connected using WiFi. For a 3G connection, a different set of properties needs to be changed and the way we change them is also little different.

getprop | grep dns - Listing the properties with dns

Method-1 [Manual]

Your device should be rooted. Check out these instructions to root your device with a single-click.

Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device.

Connect your Android device to your PC on debug mode. Enable USB debugging on your phone. Settings > Applications > Development > USB debugging.

On your laptop, open a command prompt and enter “adb shell”.

Use the command “getprop | grep dns” to know all the dns properties being used. This command requires BusyBox. Please install it if you have not done it earlier.

‘rmnet0’ is the interface name for the 3G connection. net.rmnet0.dns1 and net.rmnet0.dns2 are the properties to be changed to point to OpenDNS server. Since, these properties are changed after the connection is established, net.dns1 and net.dns2 also have to be changed.

Execute these commands as root user: setprop net.rmnet0.dns1 208.67.222.222. setprop net.rmnet0.dns2 208.67.220.220. setprop net.dns1 208.67.222.222. setprop net.dns2 208.67.220.220

Done. You can test if the settings are proper by visiting http://welcome.opendns.com. Remember, the settings will be applicable only for the current session.

OpenDNS test page SL4A scripts folder

Method-2 [Semi-Automated]

If you don’t want to take the pain of connecting your device to laptop and then changing the settings, try out this method. It uses a wrapper script which executes on your phone.

Download and install Scripting Layer for Android (SL4A). This has interpreters for executing your shell script (in fact, lots of other scripting languages also) from your phone.

Download the wrapper script I have written from here. This wraps all the commands needed for changing the DNS server in a shell script.

Move the script to /sdcard/sl4a/scripts/. (adb push change-dns.sh /sdcard/sl4a/scripts/.)

For easy access, add the scripts folder to your home screen. Long press on the home screen > Folders > Scripts. Open the scripts folder and you should see the script (“change-dns.sh”) which you have copied in the above step. All the above steps are needed to be done just once.

Click on the script to launch it. Grant the Super user permission when asked for. You just have to run this script whenever you are connecting to your mobile network.

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-25 09:33:43

改变查看修改安卓手机的DNS的相关文章

安卓手机已保存WiFi密码查看助手(开源)

一.需求分析 最近电脑需要连接WiFi,却发现WiFi密码给忘记了.而手机里有保存过的WiFi密码,但是在手机的设置界面看不到. 虽然已经有一些可以查看WiFi密码的app,但是主要还是担心密码被那些app传到后台去.还是自己写一个比较放心.而且用app查看只需要点击一下,要比直接查找系统里保存了密码的文件更加方便. 二.主要功能实现 2.1 读取系统文件 Android系统保存了WiFi密码的文件保存在/data/misc/wifi/wpa_supplicant.conf中[1],通过在代码中

安卓手机修改host

 电脑修改法 1.手机必须先root,小米可以安卓开发版系统即可 2.安卓 adb工具(android debug bridge) 3.依次执行下面的命令 1.adb root 获得root权限 会自动启动server 2.adb remount 设置/system为可读写: 3.adb pull /system/etc/hosts 将手机的hosts文件复制到PC的C盘根目录 4.PC机上打开hosts文件,修改完成后,保存 5.adb push hosts /system/etc/ 将PC机

(完美亲测)可行的安卓手机一键修改型号的教程

安卓手机型号特别多,产品出的也快,手机一下子就成了老机器了,有没有办法可以修改手机的型号,许多做项目的朋友应该也有这样的需求,下面分享一个实用快捷的型号等手机参数修改工具琢石模拟器,这也是朋友分享给我的,我现在亲测可行分享给大家,希望对有需要的朋友有帮助. 琢石模拟器官网上有教程跟手册,只要按照他们教程操作激活就行,激活之后可以方便的一键生成一套完整的手机参数,其中包括imei.imsi.mac.serial.位置经纬度等等100多种参数,当然包括我们需要的手机型号,然后在应用面板中启动应用,应

安卓手机修改IMEI的工具软件修改器琢石模拟器的安装和激活

介绍安卓手机IMEI修改软件琢石模拟器,琢石模拟器能够动态模拟手机型号.位置经纬度.串号等参数,保护手机真实参数不被恶意软件非法获取.本文介绍安卓系统xposed框架的安装和激活,以及琢石模拟器在xposed框架中的激活流程. 软件使用前提条件: xposed安装器 琢石模拟器安装软件 手机已经root 1.从官网http://www.zs8k.com/上下载琢石模拟器安装文件 2.点击附件链接进入下载xposed框架安装文件 3.安装之后,打开xposed安装器,点击“框架” 4.点击“安装/

安卓手机ADB驱动干什么的?

Adb驱动是什么意思? /div> Adb是英文Android Debug Bridge的英文缩写,是debug工具,如果不是写IT的可能也很难理解debug的意思.说的直白一点就是Adb就是手机与电脑相连的桥,要想用电脑调试和管理手机就必须先安装Adb工具包,我们借助adb工具可以在电脑上给手机安装软件,运行shell命令,系统升级. 查看更多关于Adb驱动 .. 如何安装Adb驱动? 早些年我们在玩智能手机的时候安装adb驱动都需要在国外的一些网站上去找adb驱动程序,然后安装在电脑上连接手

修改Android手机内核,绕过反调试

0x1.手机设备环境 Model number: Nexus 5 OS Version: Android 4.4.4 KTU84P Kernel Version: 3.4.0-gd59db4e 0x2.Android内核提取 查找Android设备的boot分区文件.高通芯片的设备可以通过下面的命令进行查找. cd /home/androidcode/AndroidDevlop/modifyNexus5Boot adb shell ls -al /dev/block/platform/msm_s

部分安卓手机微信浏览器中使用XMLHttpRequest 2上传图片显示字节数为0的解决办法

前端JS中使用XMLHttpRequest 2上传图片到服务器,PC端和大部分手机上都正常,但在少部分安卓手机上上传失败,服务器上查看图片,显示字节数为0.下面是上传图片的核心代码: HTML <input type="file" id="choose" capture="camera" accept="image/*"> JavaScript var filechooser = document.getEleme

安卓手机定位研究

Android 基站定位源代码 经过几天的调研以及测试,终于解决了联通2G.移动2G.电信3G的基站定位代码.团队里面只有这些机器的制式了.下面就由我来做一个详细的讲解吧. 1 相关技术内容 Google Android Api里面的TelephonyManager的管理. 联通.移动.电信不同制式在获取基站位置的代码区别. 通过基站的基本信息,通过Google Gears获取对应的GPS经纬度. 通过Google Map API根据GPS经纬度获取当前位置. 2 目前存在的几个问题 由于得到的

安卓手机抓包

通过Fiddler:应用走代理,待续... 通过tcpdump程序: root安卓手机 下载android_sdks\platform-tools\adb.exe(我本机原来下有) 下载程序tcpdump:http://pan.baidu.com/share/link?shareid=375938&uk=3290099006 用数据线连接安卓手机,并拷贝tcpdump到手机目录/data/local/(教程是通过cmd复制,我运行显示没权限,于是用RE文件管理器移动到/data/local下面)