2

Currently, I am running a hotspot from an Android phone as my home network. The cellular plan for this phone has unlimited data.

When I host the hotspot, connected devices detect that this hotspot has a cellular connection behind it, and treats it as a cellular connection. This, for example, limits connected Android phones to not back up photos via Google Photos if the "back up over cellular data" option isn't enabled.

Can I somehow edit the way the hotspot is being run, so that it doesn't signal to connected devices that there is a cellular connection in the background?

The hosting phone is rooted, and I have no trouble using a terminal-based setup (with hostapd or similar)

EDIT: Additional information:

 raphael:/ # netstat -lntup | grep -E ':53|:67'
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      22525/dnsmasq
tcp        0      0 192.168.166.70:53       0.0.0.0:*               LISTEN      22525/dnsmasq
tcp6       0      0 2a00:801:237:80f8::c:53 :::*                    LISTEN      22525/dnsmasq
tcp6       0      0 ::1:53                  :::*                    LISTEN      22525/dnsmasq
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           17668/mdnsd
udp        0      0 127.0.0.1:53            0.0.0.0:*                           22525/dnsmasq
udp        0      0 192.168.166.70:53       0.0.0.0:*                           22525/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           2243/com.android.networkstack.process
udp6       0      0 :::5353                 :::*                                17668/mdnsd
udp6       0      0 :::5353                 :::*                                17668/mdnsd
udp6       0      0 2a00:801:237:80f8::c:53 :::*                                22525/dnsmasq
udp6       0      0 ::1:53                  :::*                                22525/dnsmasq

raphael:/ # cat /proc/22525/cmdline
/system/bin/dnsmasq--keep-in-foreground--no-resolv--no-poll--dhcp-authoritative--dhcp-option-force=43,ANDROID_METERED--pid

  • 1
    It's because Android's DHCP server sends ANDROID_METERED DHCP option to connected clients. You can set connection unmetered on connected hosts, see screenshot in this answer: https://android.stackexchange.com/a/215528/218526 – Irfan Latif Dec 17 '20 at 10:17
  • Thank you! I was looking to implement it from the hotspot side (to avoid having to change every connected device), but this is a step along the way! – Rydberg1995 Dec 17 '20 at 10:48
  • Which Androis version your hotspot device is running? If it's Android 9 or earlier you can edit dnsmasq commandline arguments. I can write a bit detailed answer. What does netstat -lntup | grep -E ':53|:67' and pgrep -a dmsmasq return when hotspot is on? – Irfan Latif Dec 17 '20 at 13:23
  • The hotspot phone is running Android 11, so that might be a problem. I edited my original post with output of the commands you wrote. – Rydberg1995 Dec 17 '20 at 15:17
  • Unfortunately both commands you have run don't provide the info I'm looking for. Run netstat with root so that last column is not empty. pgrep was supposed to show the running dnsmasq process. Instead you can try cat /proc/$(pgrep dnsmasq)/cmdline. // You can use https://pastebin.com to share command output. – Irfan Latif Dec 17 '20 at 16:10
  • I thought that was the case. I've updated it with more reasonable outputs now. Thanks! – Rydberg1995 Dec 17 '20 at 16:39
  • Hmm. dnsmasq is listening on port 53, as DNS server. But on port 67 Android's Java stack is listening as DHCP server, as expected. So it's not a straightforward option to remove ANDROID_METERED option, as we can do with dnsmasq on Android 9 and earlier versions. Still there is a possibility to manipulate DHCP options using third party software like dhcpoptinj. However I've never tried this. – Irfan Latif Dec 18 '20 at 03:01
  • 1
    I see. Thanks for the tip about injecting dhcp options, I'll check it out! – Rydberg1995 Dec 18 '20 at 08:58
  • Another option is not to use Android's hotspot feature at all. Instead create hotspot from commandline. This answer may help: https://android.stackexchange.com/a/217896/218526 – Irfan Latif Dec 18 '20 at 12:12
  • Thanks, I actually saw that post, but my device (running an AOSP-based ROM) didn't have iw and some of the other commands mentioned in the guide. – Rydberg1995 Dec 18 '20 at 13:31
  • I've all of the 4 statically built binaries. But I don't think they are missing in any Android release. Android framework itself rely on these binaries under the hood. Check your /system and /vendor in depth. – Irfan Latif Dec 18 '20 at 13:42
  • I did a 'find / -name "iw"' and nothing came up, but maybe its hidden somewhere... – Rydberg1995 Dec 18 '20 at 13:59
  • Might be. Exceptions may exist. – Irfan Latif Dec 18 '20 at 14:01

0 Answers0