How to over-ride google DNS on V9 ethernet?

99 views
Skip to first unread message

David White

unread,
Feb 1, 2023, 6:46:47 PM2/1/23
to Android-x86
I have forced Android x86 to NOT use virtual wifi instead of ethernet by adding VIRT_WIFI=0 to the kernel startup line in grub. Basically this works great and avoids issues I was having with MDNS and the virtual wifi.

But in settings, I can find no way to control the ethernet. I have a pihole running and I want to point to that for all DNS instead of the google DNS that Android x86 seems to insist upon using (at least judging from use of nslookup).

I am sure there is a way I can accomplish this but have no idea what it is. I saw some references to ndc resolver commands but they just mucked things up.

If I have to do this manually post-boot every time, I can use Tasker and root shell to get the job done. But it seems like there should be a more reasonable way.

Thanks

Michael Goffioul

unread,
Feb 2, 2023, 2:58:17 AM2/2/23
to andro...@googlegroups.com
By default, android-x86 probably uses the DNS settings from the DHCP lease, so if you control DHCP you might redirect android-x86 to your own DNS. Ethernet connections cannot be configured like WiFi ones in Android settings, in particular overriding DNS. However, there is apparently the possibility to configure a system-wide private DNS, but it has to support DNS-over-TLS: https://www.androidauthority.com/how-to-change-dns-server-3192543/ (scroll to the section about Android).

--
You received this message because you are subscribed to the Google Groups "Android-x86" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-x86/0e1412b2-b120-49a8-996e-51998ec4cedbn%40googlegroups.com.

David White

unread,
Feb 2, 2023, 2:19:44 PM2/2/23
to Android-x86
Thanks Michael...

In my Android x86 installation, again with virtual wifi disabled on purpose, there is no ethernet connection settings to permit me to modify network settings like I might with wifi on any other Android. I have had several Android TV boxes (like Minix) and while they did have provision for ethernet settings specifically, they were NOT part of the standard, Android settings. They were always in a special, TV box settings app. I had hoped Android x86 might do similar but I have not found it. I have searched the Android x86 settings app for "lan", "ethernet", "network", etc and found nothing to help.

I have set up my router's DHCP to always give Android x86 (and almost all my other devices) static ip and, along with that, the router's IP for DNS. And to at least some extent, that seems to be getting through to Android x86 as the results of getprop net.dns1 is the router's IP and getprop net.dns2 is blank (as I would expect).

But I am trying to confirm that this actually is being used. So I try nslookup google.com and the nslookup command shows which DNS server it is using. On Android x86, this is always 8.8.4.4, a google, public DNS server. On other devices (Windows Android, Linux) such commands show the DNS server supplied by the router's DHCP.

I am not sure of any other good way to see what DNS server is actually being used on Android x86. I had hoped it would be seen in the output of ifconfig -a but it is not. Perhaps someone can suggest another way?

Cheers!

David White

unread,
Feb 2, 2023, 2:28:40 PM2/2/23
to Android-x86
Actually, I just tried using this app from Play Store. And it clearly shows how ethernet is configured. And the DNS shown is my router's IP. I am not sure how this app works of gets its information. Perhaps there is something about the nslookup that is bundled with Android x86? I doubt it as that comes from busybox and I have updated the included busybox install with a later version via Stericson's app. Hmmm...

Michael Goffioul

unread,
Feb 2, 2023, 2:57:12 PM2/2/23
to andro...@googlegroups.com
The way command-line tools work can be very different from how an Android app will actually work, e.g. regarding network aspects. Don't trust what such a command-line tool outputs, unless it is part of AOSP. But busybox is not (it may implement things the "Linux" way, but it may be irrelevant on Android). If you really want to be sure what DNS apps are actually using, maybe you can capture traffic with tcpdump and analyze it in wireshark. On Android 9, I think the net.dnsX properties are still relevant (they don't exist anymore nowadays), so I think there's a very good chance your device is using the correct DNS.

David White

unread,
Feb 2, 2023, 3:46:10 PM2/2/23
to Android-x86
You may have a point there Michael. I have never had an issue before with busybox nslookup but that doesn't mean much. I looked at the source code for the version I have in use now and saw an include reference to "Use internal resolver code instead of libc" and that triggered something about a technique I saw used to change the DNS server using ndc resolver... and I went looking for more information on it. According to method 6 shown here, the file /system/etc/resolv.conf may be involved. I checked on my Android x86 and here I found the DNS server IP being used in nslookup. I saved the original and edited the file to use my router's IP instead of the 2 google DNS servers it contained.

As soon as I did that, without rebooting or anything else, nslookup reported using my router's IP for the DNS server. Further investigation of that source code demonstrates that it does indeed parse resolv.conf under certain circumstances. But I also checked for the busybox version where this is not happening on other devices and the same code is present. Yet on those devices, nslookup does NOT do the same thing. On at least one of those devices, there is no /system/etc/resolv.conf file at all. So I tried removing that file entirely but nslookup failed to run at all. So had to put it back.

Anyhow, thanks.

endrich...@googlemail.com

unread,
May 8, 2023, 5:23:48 AM5/8/23
to Android-x86
In case anyone gets here by google or by search:

In Summary:

get your default netid, e.g. with: 

dumpsys netd | grep 'Default network'

and than set the dns server via ndc resolver command.
so if your default netid is 102:

ndc resolver setnetdns 102 "" 8.8.8.8
Reply all
Reply to author
Forward
0 new messages