Search code examples
androiddnsvpnandroid-10.0

DNS only VPN service on Android Q


We use VpnService to setup a VPN with custom DNS settings. We're just interested in changing the DNS settings for the device.

On current versions of Android (P and below) by not setting the route in the VPN, service traffic is routed directly to the app and DNS requests are sent to the addresses provided. We don't need a TUN interface as we're not providing and true VPN service.

On Android Q beta 3 the VPN is established but the DNS settings are ignored. What has changed ?

Here's how we start the service in the onStartCommand

                b.addAddress("10.0.2.15", 32);
                b.addDnsServer("8.8.8.8");
                b.addDnsServer("8.8.4.4");
                b.establish();

Solution

  • The DNS configuration does actually work.

    My observation that it wasn't is actually being caused by Chrome. Chrome (not sure which versions) uses its own dns resolver, circumventing the DNS settings applied by the VPN.

    Discussion here: https://www.xda-developers.com/fix-dns-ad-blocker-chrome/