Using an internal DNS server

So how did you set the DNS servers? There are many ways to do this in Android… Did you use setprop?

@Drezil At the end, everything worked without using the customized script. It works so feel free to use it :wink:

@StephanK I first tried to set them in the WiFi settings using a static IP. But it seems I fooled myself by setting a second DNS server pointing to an external DNS server. Now I’m back to using normal DHCP and it seems to work fine. The adb logcat output that @chrmhoffmann mentions helps to see what DNS server is used. So, no, I didn’t use setprop nor ndc resolver.

@m4lvin That’s very interesting. So another stone I tripped over. In that file, indeed, g*'s servers are mentioned. Lesson learned: termux sets up an environment completely separate from the main one. Thanks for making that clear.

1 Like

Thanks. I already tried to set a different DNS server since I don’t like Google very much. My first attempts included setprop and AFWall+ with a custom iptables script. To no avail, unfortunately.

I have the feeling that, by default, the DNS servers from your provider are used. Not the ones from g*.

Or do you another impression ? I would really like to know since I don’t want all my DNS queries to end up feeding g*'s bottom line.

Honestly, I actually don’t know. I guessed it would be Google’s DNS servers because it might be hardcoded into Android, but neither do I have proof nor the ability to check.

Either way, both options are bad. The optimal solution would be encrypted DNS requests to non-censoring, non-recording servers. Sadly this has negative implications (wifi hotspot captive portals, for instance). I still need to evaluate an adequate option.

Just stumbed over this problem: a DNS name on my local network isn’t resolved. However host -v localname localdns-ip gives the correct result.

So this might be a stupid question, but anyway: where can I change the DNS settings for Wifi on LineageOS?

I guess the default is to use the DNS resolver of your Wifi network. Maybe it defaults to use the upstream provider? Can you add your local hosts to your local DNS resolver and only when it doesn’t find then to use upstream?

That’s what I would have guessed, too. And actually from other devices (e.g. the laptop I’m just typing on) in the same Wifi network the hostname is resolved absolutely fine. So this part is ok, it’s just the FP2 w/ LineageOS, which is not resolving he name.

Checking above suggestion

returns some IPv6 address as dns1 and my local DNS resover as dns2. Weird…

“Some IPv6 address” could not be your local IPv6 network? Any modern setup should always create IPv6 unless you actively unset it…

Yes, looks like it. This means the DNS configuration seems to be fine.
So I think I have to search somewhere else… Thanks for your hints!

I don’t think you’re able to use a VPN for blocking ads (such as DNS66) plus a real VPN.

OpenVPN config should allow you to set the DNS.

If you’re running a VPN server on your home network which you can access from the outside, then you should be able to use an internal DNS server such as a Pi-Hole. A decent way to block ads without having root. The downside is it will consume more of your battery (which 4G would also do) since OpenVPN will encrypt all the traffic.

Generally, I can recommend to use DNSCurve (DNSCrypt) but on Android that’s AFAIK not possible without root. However if you’re going with a VPN then tunneling the DNS requests through the VPN to the internal network where a DNS server runs which uses DNSCrypt.

https://www.dnscrypt.org/#dnscrypt-android

Often /etc/resolv.conf or equiv gets an entry (from DHCP server) to search for a domain. E.g. lan. Then looking up e.g. fp2.lan will resolve to an IP address and works when you search for fp2 only since .lan gets appended. Whether that’s the case here, I don’t know.

It might also be that your LAN resolver only listens to IPv4.

Those are my 2 initial wild guesses :slight_smile:

The interesting thing is that it used to work until recently - however I don’t exactly know when.
Maybe it’s not the phone after all…
I think I’ll have to check my LAN setup first.

Do you have a Chromecast on your network?

Does it only not work on FP2?

This topic was automatically closed after 183 days. New replies are no longer allowed.