Android 10 hotspot static ip routing issue
1
vote
0
answers
54
views
I am running LineageOS 20 (Android 10) on my Xiaomi Redmi 9 (lancelot) rooted using Magisk.
I started a WiFi-hotspot and based on https://android.stackexchange.com/a/213626/521733 , I used the following commands from a root shell:
lancelot:/ # ip a show ap0
35: ap0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether c2:98:90:46:b0:dc brd ff:ff:ff:ff:ff:ff
inet 192.168.233.181/24 brd 192.168.233.255 scope global ap0
valid_lft forever preferred_lft forever
inet6 fe80::c098:90ff:fe46:b0dc/64 scope link
valid_lft forever preferred_lft forever
lancelot:/ # ip a add 192.168.100.1/24 dev ap0
Then, I connected to the hotspot using three methods:
1. DHCP
Client received an IP: 192.168.233.81/24
Obviously, I was able to ping the Android gateway, as expected.
2. Static IP withing the 233 subnet
Client IP: 192.168.233.10/24
Gateway and DNS: 192.168.233.81
Once again, I was able to ping the Android gateway, as expected.
3. Static IP within the 100 subnet
Client IP: 192.168.100.10/24
Gateway and DNS: 192.168.100.1
**I was not able to ping the Android gateway.**
There aren't any iptables rules that would drop this traffic:
lancelot:/ # iptables-save | grep tether
:tetherctrl_raw_PREROUTING - [0:0]
-A PREROUTING -j tetherctrl_raw_PREROUTING
-A tetherctrl_raw_PREROUTING -i ap0 -p tcp -m tcp --dport 21 -j CT --helper ftp
-A tetherctrl_raw_PREROUTING -i ap0 -p tcp -m tcp --dport 1723 -j CT --helper pptp
:tetherctrl_nat_POSTROUTING - [0:0]
-A POSTROUTING -j tetherctrl_nat_POSTROUTING
-A tetherctrl_nat_POSTROUTING -o wlan0 -j MASQUERADE
:tetherctrl_mangle_FORWARD - [0:0]
-A FORWARD -j tetherctrl_mangle_FORWARD
-A tetherctrl_mangle_FORWARD -p tcp -m tcp --tcp-flags SYN SYN -j TCPMSS --clamp-mss-to-pmtu
:tetherctrl_FORWARD - [0:0]
:tetherctrl_counters - [0:0]
-A FORWARD -j tetherctrl_FORWARD
-A tetherctrl_FORWARD -j bw_global_alert
-A tetherctrl_FORWARD -i wlan0 -o ap0 -m state --state RELATED,ESTABLISHED -g tetherctrl_counters
-A tetherctrl_FORWARD -i ap0 -o wlan0 -m state --state INVALID -j DROP
-A tetherctrl_FORWARD -i ap0 -o wlan0 -g tetherctrl_counters
-A tetherctrl_FORWARD -j DROP
-A tetherctrl_counters -i ap0 -o ccmni1 -j RETURN
-A tetherctrl_counters -i ccmni1 -o ap0 -j RETURN
-A tetherctrl_counters -i ap0 -o wlan0 -j RETURN
-A tetherctrl_counters -i wlan0 -o ap0 -j RETURN
Why is it not working? What is dropping the traffic? How do I fix it?
My use case is as follows: I need to connect a Raspberry Pi to the hotspot and access it from my phone. Unfortunately Android hotspot subnet is set randomly, so I don't know the IP address that the client got assigned. mDNS does not seem to work, so the only other option I can think of is a static IP on a different, non-random subnet.
Asked by mopalinski
(11 rep)
Mar 2, 2025, 03:40 AM
Last activity: Mar 2, 2025, 03:52 AM
Last activity: Mar 2, 2025, 03:52 AM