Android comes with a setting called Private DNS that allows us to use DNS-over-TLS instead of a regular DNS as the system-wide domain resolver. However, because that setting is hidden on Android TV, enabling it there is not as easy as enabling it on Android smartphones.
But thanks to Android’s Developer Mode, we can enable it on Android TV via ADB command. The following below are the steps to enable it there.
Enable the Developer Mode
- The first step is to enable Developer Mode on Android TV. We do it similarly to Android smartphones by clicking the build number information,
which can be found in the
Settings > Device Preferences > About > Android TV OS build
menu. Just click/tap it seven times! - The second step is to enable the USB debugging option. Go to the
Settings > Device Preferences > Developer options
menu and enable theUSB debugging
option. - After that, we need to know the TV’s IP address, which can be found in the
Settings > Network & Internet
menu. Select the connected network and look for the IP address information.
Now that the TV is configured to allow remote access, we need a computer to enable the Private DNS remotely.
Setting it up remotely from a computer
- The computer has to be connected to the same local network and already installed the
adb
command. - Connect to the TV using the following command. Replace the IP address in the example with the TV’s IP. On the first attempt, it will likely fail. No worries! Just check the TV screen and click Allow on the dialog box notice that is popping up there. Try to connect again with the same command. It should be successful the second time.
# note: it will be failed on the first attempt
adb connect 192.168.1.xxx
- Run the following commands. Substitute the DNS with your preferred DNS-over-TLS service.
adb shell settings put global private_dns_mode hostname
# note: substitute family.cloudflare-dns.com with your preferred dns
adb shell settings put global private_dns_specifier family.cloudflare-dns.com
Testing and cleaning-up
To verify that everything works fine, install a browser on the TV and navigate to dnsleaktest.com. Check if the correct DNS server is showing up there. It should show Cloudflare’s server if you use the same DNS as the above example. Or, if you are like me, using NextDNS, you can open test.nextdns.io and see the result there.
Last thing, if everything works as expected, we can set the Developer Mode back to its initial state.
Go to the Settings > Device Preferences > Developer options
menu and turn off the first option.
VoilĂ ! The Android TV is now using Private DNS nicely.