Skip to content

Instantly share code, notes, and snippets.

@anhhp0
Forked from sharunkumar/adb-dns.bat
Last active September 12, 2023 16:39
Show Gist options
  • Save anhhp0/5b86ad6e3375eec34002d36bf95dda3a to your computer and use it in GitHub Desktop.
Save anhhp0/5b86ad6e3375eec34002d36bf95dda3a to your computer and use it in GitHub Desktop.
Enabling / Disabling private DNS in android via ADB
rem to disable private dns
adb shell settings put global private_dns_mode off
rem to enable private dns with hostname (example with dns.nextdns.io)
adb shell settings put global private_dns_mode hostname
adb shell settings put global private_dns_specifier dns.nextdns.io
rem or with yourID
adb shell settings put global private_dns_specifier yourID.dns.nextdns.io
rem or with yourID, Identify your devices
adb shell settings put global private_dns_specifier DeviceName-yourID.dns.nextdns.io
rem Prepend the name to the provided domain (the name should only contain a-z, A-Z, 0-9 and -). Use -- for spaces.
rem For "anhhp0 AndroidTV", you would use anhhp0--AndroidTV-yourID.dns.nextdns.io
rem to enable private dns with hostname (example with dns.adguard.com)
adb shell settings put global private_dns_mode hostname
adb shell settings put global private_dns_specifier dns.adguard.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment