I've got a local network with associated WiFi where I'm already running a DNS server and I can resolve somehost.local.example.com on any machine in that network just fine.

On Android I can only resolve those host names when I turn off "Private DNS" and I understand why. However, I'd like to keep the "Private DNS" feature enabled in general.

Is there some way to either disable Private DNS when I'm in a specific WiFi network (either autodetected some way or even manually configured on my phone is fine) or to ensure that local host names (within the DHCP servers search domain) are still resolved using the DHCP-provided DNS even when Private DNS is enabled?

My phone is running Android 12, in case that matters.

  • If you could use both local DNS and private DNS at the same time how should your phone know which DNS server to use for what query?
    – Robert
    Jan 27, 2022 at 13:27
  • @Robert: based on the known prefix for local host names. The DHCP server provides the domain for the local network and I'd like the local DNS (also provided by the DHCP server) to be used for anything with that suffix (i.e. if the DHCP server says its local network is local.example.com then I'd like any hostname ending in .local.example.com to be routed to the local DNS and anything else elsewhere). Jan 27, 2022 at 13:42
  • 1
    reddit.com/r/tasker/comments/9yvo2h/… looks like what you are after
    – beeshyams
    Feb 15, 2022 at 9:10
  • 1
    @beeshyams: yes, this seems at least a partial solution. It allows me to enable/disable private DNS on some condition without having to have root (but involving a couple of manual steps). In an ideal world I'd even do the "split DNS" thing I mentioned above, but if this were an actual answer with details, someone could probably earn that bounty. Feb 15, 2022 at 9:31
  • 1
    android.stackexchange.com/q/239398/131553. closely related?
    – beeshyams
    Feb 15, 2022 at 10:02

1 Answer 1


I guess we can maintain the DNS while connecting to a wifi network by choosing advanced -> Static IP.

I tried to modify the wifi network on Samsung phone running Android 12 and I can see the option for DNS.

Modify Wifi Network

I hope this helps, if that's what you need.

  • I seriously doubt this helps, because that's just setting the same thing that's otherwise provided by the DHCP server. The issue is that "Private DNS" ignores those settings and uses pre-configured servers anyway. Feb 16, 2022 at 22:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .