I have an Orangepi5b running Android 12. I want to use Wi-Fi for internet connection and Ethernet to communicate to other network devices connected to it simultaneously.
I've read a lot of questions about it but there were no answers, or answers are outdated:
- Connect Android device to Wifi for internet and ethernet simultaneously
- https://stackoverflow.com/questions/63499840/android-9-ethernet-and-wifi-simulataneously
- https://stackoverflow.com/questions/18143534/android-ethernet-and-wi-fi-at-the-same-time?rq=4
- https://stackoverflow.com/questions/28991965/getting-wrong-network-interface-in-android?rq=4
- https://stackoverflow.com/questions/31713781/connect-to-lan-and-internet-at-same-time?rq=4
- How to make Ethernet work on Android over OTG?
I connected my Ubuntu laptop to debug connection. I used static IP on Ubuntu and configured static IP on Android for Ethernet connection. In Android terminal I can ping my laptop
ping 172.XXX.XXX.XXX
After that I connect to Wi-Fi, I'm able to ping sites like Google but can not ping my laptop. But I can ping my Android device from my laptop. In my opinion it means that this is problem with routes in Android
I've checked routes on Android:
busybox route
And this is the output:
Destination Gateway Genmask Flags Metric Ref Use Iface
172.XXX.XXX.XXX * 255.255.254.0 U 0 0 0 eth0
192.XXX.XXX.XXX * 255.255.255.0 U 0 0 0 wlan0
It seams that routes are configured properly. If I want to ping my laptop I should explicit use interface for that:
ping -I eth0 172.XXX.XXX.XXX
I can use
su
ip route add 172.XXX.XXX.XXX dev eth0 table local
After that I can ping my laptop and use internet from Wi-Fi.
But it not works when I reboot the Android device. If rebooted I need to disable Wi-Fi, connect to Ethernet, after that connect to Wi-Fi and add route again.
Is it way to save routes to work after reboot, or may be another way to add route to work permanently?