"Private DNS server cannot be accessed"
I sometimes get this message on my Android devices when on wifi.
- This error only happens on my Android devices, and only occasionally.
- It usually resolves itself after several hours.
- Switching to cellular data restores internet connectivity.
- Disabling Private DNS restores internet connectivity even though my router is configured to forward all DNS requests to NextDNS.
- When experiencing this error the device cannot reach my CalDav and CardDav servers, even though they're on the same local network.
What's going on here? This never happens with my Linux laptops.
The fault may be that it cannot resolve your internal servers.
When your phone is configured to use an external DNS provider like NextDNS, it will only receive the public IP addresses that have been defined on your public DNS Server. These IP addresses are then mapped using a Network Address Translation table in your router to point to an Internal IP address.
Normally when you are on your own network, DNS resolving is done by your internal DNS server (which refers out to external ones for DNS names that are not on your own network). Hence when a device on the internal network tried to connect to an internal CardDav server, for example, it is normally provided with the internal IP address.
However, if you have told your phone to use a Public DNS server then when it is on your LOCAL network it will still be asking NextDNS for the PUBLIC IP address, which will not work on your local network.
If this is the case you have two choices to make it work:
1. Switch your phone to use your internal DNS server (e.g. router) when on your local network, or
2. Configure a NAT rule on your router for the internal interface your phone is on, that forwards the PUBLIC IP addresses of your servers to the internal IP addresses of your servers.
In my case I did the later for all the internal devices that my phone needs to see and thus I could keep it using nextDNS all the time.