Skip to content

Instantly share code, notes, and snippets.

@hermesthecat
Forked from CHEF-KOCH/20-dns.conf
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save hermesthecat/551fa3e2ac0311e05241 to your computer and use it in GitHub Desktop.

Select an option

Save hermesthecat/551fa3e2ac0311e05241 to your computer and use it in GitHub Desktop.
# 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 208.67.222.222
setprop dhcp.eth0.dns2 208.67.220.220
}
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
#DNS
setprop ro.kernel.android.ndns=1 #choose 1 or 2
net.dns1=208.67.222.222
net.dns2=208.67.220.220
net.eth0.dns1=208.67.222.222
net.eth0.dns2=208.67.220.220
net.rmnet0.dns1=208.67.222.222
net.rmnet0.dns2=208.67.220.220
dhcp.tiwlan0.dns1=208.67.222.222
dhcp.tiwlan0.dns2=208.67.220.220
net.ppp0.dns1=208.67.222.222
net.ppp0.dns2=208.67.220.220
net.pdpbr1.dns1=208.67.222.222
net.pdpbr1.dns2=208.67.220.220
#!/sbin/sh
if grep -q dns1 /system/build.prop ; then
echo "already applied, no changes made"
else
echo "net.dns1=208.67.222.222" >> /system/build.prop
echo "net.dns2=208.67.220.220" >> /system/build.prop
echo "net.rmnet0.dns1=208.67.222.222" >> /system/build.prop
echo "net.rmnet0.dns2=208.67.220.220" >> /system/build.prop
echo "dns properties added to default.prop"
fi
# For CWM.
#!/system/bin/sh
setprop dhcp.tiwlan0.dns1 208.67.222.222
setprop dhcp.tiwlan0.dns2 208.67.220.220
setprop net.ppp0.dns1 208.67.222.222
setprop net.ppp0.dns2 208.67.220.220
setprop net.dns1 208.67.222.222
setprop net.dns2 208.67.220.220
setprop net.rmnet0.dns1 208.67.222.222
setprop net.rmnet0.dns2 208.67.220.220
setprop net.pdpbr1.dns1 208.67.222.222
setprop net.pdpbr1.dns2 208.67.220.220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment