Skip to content

Instantly share code, notes, and snippets.

@sharunkumar
Created February 7, 2020 07:08
Show Gist options
  • Save sharunkumar/b6195cbbd26a0039ec87fbd3829aa6b3 to your computer and use it in GitHub Desktop.
Save sharunkumar/b6195cbbd26a0039ec87fbd3829aa6b3 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.adguard.com)
adb shell settings put global private_dns_mode hostname
adb shell settings put global private_dns_specifier dns.adguard.com
@myjunkjp
Copy link

exactly what I needed. Thanks

@ManuelGotzen
Copy link

great simple batch. thx

@VnmHnnS
Copy link

VnmHnnS commented Nov 17, 2023

Thank ♥

@ManuelGotzen
Copy link

Ya we'come

@1x12HD
Copy link

1x12HD commented Dec 27, 2023

Much appreciated!

@markettepigeon
Copy link

Be careful because on second generation Firesticks (Fire TV 4K MAX) the commands that allow you to change the DNS completely block your internet connection on all your connections.

@Mondei1
Copy link

Mondei1 commented Jun 30, 2024

Btw, thank you for this small gist. It helped me to resolve an issue I had on my Quest 3: https://www.reddit.com/r/OculusQuest/comments/1drpihc/quest_3_constant_wifi_reconnects_but_with/

The WiFi was reconnecting the entire time because of some weird IPv6 DNS issue. Setting a private DNS this way (because the UI doesn't support it) resolved the issue somehow 🤷

@deltaxsingh
Copy link

Awesome thanks!

@OxfordReborn
Copy link

Fire 7, 12th Gen, 8.3.3.3
Shizuku, aShell
Commands from the batch file (each skipping "adb shell") worked flawlessy! A huge huge thank you!

@SurajKharkwal
Copy link

What if I want to make the dns read-only , I mean such that it can't be changed from mobile at least

@crafty991
Copy link

crafty991 commented Oct 19, 2025

I ran those ADB commands on the Fire Stick 4K Max 2nd Gen and it worked for about a month and a half. But now I'm having problems with the Internet connection: when I start it up, I get a “No Internet connection” warning and there's no way to get it to work (I've already tried restarting both the router and the Fire Stick). The only way to fix it is to disable private DNS with the command “settings put global private_dns_mode off.” Is anyone else experiencing the same problem and has found a solution?

Additional information: I use NextDNS, but the problem also occurs with other DNS servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment