Created
January 21, 2014 09:36
-
-
Save syu-id/8537124 to your computer and use it in GitHub Desktop.
Android DNS configuration: use Google Public DNS;
file: /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf;
source:
- http://blog.varunkumar.me/2010/09/how-to-change-dns-server-on-android.html
- http://varun-scratchpad.googlecode.com/svn/trunk/static/20-dns.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set net.<iface>.dnsN properties that contain the | |
# DNS server addresses given by the DHCP server. | |
set_dns_props() | |
{ | |
case "${new_domain_name_servers}" in | |
"") return 0;; | |
esac | |
count=1 | |
for i in 1 2 3 4; do | |
setprop dhcp.${interface}.dns${i} "" | |
done | |
count=1 | |
for dnsaddr in ${new_domain_name_servers}; do | |
setprop dhcp.${interface}.dns${count} ${dnsaddr} | |
count=$(($count + 1)) | |
done | |
setprop dhcp.eth0.dns1 8.8.8.8 | |
setprop dhcp.eth0.dns2 8.8.8.4 | |
} | |
unset_dns_props() | |
{ | |
for i in 1 2 3 4; do | |
setprop dhcp.${interface}.dns${i} "" | |
done | |
} | |
case "${reason}" in | |
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;; | |
EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment