Complete DNS failure after frequent switching between WiFi and Mobile networks

Firstly, thanks so much for all you work on Blokada! I really appreciate it and have been using it for a few years now.

I run Blokada 5.10.1 from F-Droid on an Android phone (Google Pixel 3, fully updated Android 11).

My workplace has very poor mobile (cellular) reception and to save battery I use a company WiFi. Sadly the WiFi also has black spots (and it has a super annoying guest portal which I have to sign in to after leaving it for only 5 minutes!).

While walking around the office my phone will switch between WiFi and mobile networks regularly (tangent: Why is blokada 5 slower to start the VPN than early version 5 releases?) I often find that after a few such switches my phone is unable to resolve DNS entirely. My mobile browser of choice (Brave) and a weather app fail with clear DNS errors (most other apps just give generic connection type errors).

  • In Blokada’s “Networks” settings, for “All Networks” I have “Encrypt DNS” and “Use DNS: Cloudflare: malware blocking” selected.
  • However I have an override for “Any WiFi network” where “Encrypt DNS” is not selected, “Use DNS: Cloudflare: malware blocking” is selected and “Prefer network DNS” is also selected (because I don’t leave location enabled all the time and so you cannot detect my home WiFi - I require local DNS at home).

I recently switched to version 5 after you added “network DNS” support. The problem never happened in version 4 and I don’t remember noticing it in the first version of 5 which supported “network DNS” but it happens regularly now with 5.10.1.

I feel that the problem is most likely not related to the DNS servers I’ve chosen. It happened when I used the default Cloudflare server (Cloudflare have by far the lowest latency for me and I trust their privacy policy, unlike other commercial DNS providers).

When the problem happens, if I open the “Any Wifi network” setting override and toggle “Prefer network DNS” off and on again, DNS will work until my phone switches networks a few more times.
I’ve not tried disabling encrypted DNS totally but I have tried toggling Blokada off and on doesn’t seem to fix it.

Do you know how I can diagnose this please?

Thank you in advance!

I’ve just realised that encrypted DNS is only supported for vanilla “Cloudflare” DNS, not the other variants! (possibly why my home router running unbound with DoT has issues every now and then with Cloudflare: malware blocking!)

I will now try with “Encrypt DNS” disabled for all networks. I’m now using “Cloudflare: malware & adult blocking” in both the default settings and the override for all WiFi networks. I’ll see how it goes tomorrow at work.

This problem is still happening at my workplace.

I’ll see if I can simulate/reproduce the problem elsewhere.

I am experiencing the same problem with a Pixel 3a. The network feature does often not recognize the change between WiFi and mobile access. Thus, the internet connectivity is lost. Only a hard stop and restart of the blokada app solves the problem.
The settings seems to be the same as described by Blockem.

Hi there,
You can choose the used dns server for individual networks as well. Do so by tapping the button underneath the “all networks” button

Hello @PrintableCharacter
Thanks for the reply. I mentioned that I don’t have location turned on all the time for privacy reasons - Blokada is unable to detect the SSID of the network I’m on. Anyway this was only an aside - Sorry, I should have raised it in another topic.

Are you able to help with the main problem here please? Can you reproduce it at all?

It is even happening at home on the weekend - just switching back and forth between WiFi and a Mobile network seems to cause it.

Sorry to hear you’re having the problem too @darth. I’m kinda surprised that more people aren’t having it - I can’t think of anything unique about my device or Blokada configuration (well - except for having different DNS settings for WiFi and Mobile Network).

It happened to me today (on the weekend - at home) and I was able to resolve it by de-activating Blokada (waited for the VPN key to be disabled) and then re-enable Blokada. Does that temporarily resolve the problem for you?

In fact I’m currently unable to reproduce the issue. It seems rather strange. Location access isn’t about your physical location by the way. It’s an android limitation by now and the ssids will only be stored locally on your device. We’d never collect your actual location. You may not even need to turn on the GPS functionality of your device blokada will just need to be granted location permission on general. Feel free to check our Sourcecode regarding that as well since it’s not our goal that anyone trusts us blindly. We want to encourage people to criticise the project on a healthy basis :smiley:

I can’t think of anything else than that option to fix it.
Feel free to share a log with a brief description of the issue and a link to this thread with
I wish you a very pleasant day :slight_smile:

Thanks for trying! It’s a really annoying issue and happens at least once a day.

Should I try to get the log just after the problem has happened?

I disable location data because I don’t trust Google (and potentially other apps) not Blokada! Do you remember when they were caught collecting user’s location data even when people had opted-out?

Also having GPS on all the time chews power and I cannot enable the WiFi-based location without explicitly opting-in to Google location data collection.

That’d be awesome :smiley:

Thank you very much for the replies. I will also try to get a log and share it.

Actually, I have got two Android phones (Samsung and Pixel), both on Android 11.
For both phones, most of the time the individual wlan-network is not recognized, it stay on “all-wlan-networks”. But that is - for me - not an urgent issue. Even though, it would be nice, if the wlan recognition worked correctly.

The real problem happens only with the Pixel 3a, when switching from wlan to mobile network. Blokada remains often on “all wlan networks” without having wlan-connectivity or even with “wlan” in the phone’s menu turned off and only the mobile network turned on. The phone then looses connectivity (due to missing dns resolution). Only, hard stop and restart of the blokada application helps. That makes blokada difficult to be used on the Pixel.

I’ll try to share a log. Thank you very much for the effort and the great app!

Thank you again.

I’ve now sent in two emails (yesterday). Did you get them please?

This problem is really annoying, I’m thinking of reinstalling version 4 again :frowning:

Unluckily troubleshooting and log checking isn’t some type of wizardry which can be completed within a few minutes. Feel free to install V4 while we analyse this

I am having the same issue on two separate Pixel 4A 5g devices. I’ve tried different DNS servers without success.

Not every time, but often, when I such between wifi and cell, data will stop working. Toggling blokada off then makes the data work. If I then re-enable blokada, it works fine.

I was using the version right before 5.10.1 which also has the same DNS selection menu and I didn’t notice the issue.

I’d be happy to provide logs if that would help.

Studying the log of the Pixel phone, I recognize two main problems:

  1. name detection not working:
    Connectivi Wifi network fallback name detection returned null
    Connectivi Network up: 987987878979877, (null, type=WIFI)

  2. Detection of “network down” in case of wifi is sometimes not working. E.g. when wifi is manually turn off and cell is turned on, blokada’s block shows only the following entries (even after wifi been turned off):

Connectivi Network up: 786786876876, (XXX, type=CELLULAR)
W Connectivi Guessing which wifi network to use: (null, type=WIFI)

Then connectivity is lost, due to missing dns resolution.

For the record, my wife has a Pixel 3 (identical to mine) and has the same problem, but she doesn’t alternate between WiFi and mobile (cell) networks as frequently. For her the problem is triggered on occasion simply by leaving the WiFi and going on to the mobile network.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

For the record, I believe this problem first happened to us with the last update (that is 5.10.1). Before that we didn’t have any problems.

My wife’s phone is currently unable to use local DNS with the latest version 4 Blokada! I have no idea why as the settings look identical. Anyway don’t derail fixing Blokada 5, I just thought I’d mention it in case similar DNS changes had been made to both at the same time.

Thanks again!


Has there been any progress on this problem with Blokada 5 please? I’ve not seen any updates through F-Droid but then again they are always slow to release updates. Do you need me to re-test anything?

BTW: I was able to solve the problem with my wife’s phone with Blokada 4 by copying configuration from mine.

Thank you!