Smartphone USB Tethering

Hi,

I tried smartphone Tethering as I will switch providers soon and during that I'd like to use the Android smartphone during the switch-over process (which would disconnect the main line). However this doesn't work.

mySetup
openwrt router connected to DSL router (modem+router). eth0 is in subnet 192.168.0.1/24 just like the router. Its not double-NATted but there is a static route setup in the DSL router. (BR-LAN is 192.168.1.1/24) Behind openwrt are the devices (connected via BR-LAN). openwrt acts as router only, no dhcp no dns (there is another dhcp/dns in the lan)

I used the wiki page (https://openwrt.org/docs/guide-user/network/wan/smartphone.usb.tethering) and installed the kmod-usb-net-rndis on the openwrt (fritzbox 4040 with openwrt 21.02). The smartphone itself is recognized and I get an IP adress from its dhcp server on the hw interface usb0. Also if I disconnect my mainline (changing the device to usb0 on the WAN interface) I can hop on via ssh to the openwrt from a client and run there "ping google" and it resolves the adress and icmp works to the google servers. But when i try from client (that is in subnet of openwrt router br-lan) I can't even ping 8.8.8.8
I know that the smartphone tethering works also if attached to other clients directly, it seems to be something on the openwrt not forwarding the packets?

I remember in the past i managed to get it working, however i believe i had a routed phone back in the day and fiddled with the routes in the phone, but its too long ago (i think i did some route add commands)
Do I also need to add a forwarding on the smartphone like i had to do on the dsl router? How would I even do that on an unrooted phone? Or do I need to put my clients in the same subnet as the opnwrt usb0 interface is in?

Thanks for helping me out

Turn masquerading back on on wan. There is no way to add routes in a smartphone so you have to NAT from the LAN to the phone's network to serve the LAN.

Your choicre to not upgrade you will allso need ancient android to work with ancient rndis driver.
For supported version - bring old wan down, new wan up and you are ready.

For all those are interested in a solution, here is one. I am sure someone can script it if needed. Here's the manual process.

Requirements

  1. You need a rooted Android Phone. I have tested it with stone old Poco phone (Android 11 afaik)
  2. On the phone I have used termux (you might need an addon to run a sshd, configure it accordingly, see https://wiki.termux.com/wiki/Remote_Access, this might not be a hard requirement but its certainly easier)

Steps

  • Connect the phone to openwrt router and start the tethering according documentation
  • Connect to openwrt via ssh and run ifconfig to see the address the phone/DHCP server gave your interface.
  • Be aware that the usb subnet changes whenever you setup the usb tethering on phone. Its typically one of 192.168.0.0/16, e.g. your IP address on openwrt could be 192.168.42.159
  • run ssh -p 8022 192.168.42.1 to remote access your poco from from openwrt. I don't remember if it was always the first ip, could also be the gw has e.g. 192.168.42.117
  • Get root privileges on the phone by executing /bin/su
  • run ip route show table 0 this should give you a complete dump of all ip routes, be aware that the mobile phone has a lot of connections to its mobile network, look for the appropriate network (your class c subnet 192....) - for me this was typically rmnet_data0
  • run ip route show table rmnet_data0 to see the routing entries for this network only
  • add a new static route to the phone by running ip route add table rmnet_data0 192.168.1.0/24 via 192.168.42.159 dev rndis0
    (The subnet is the your BR-LAN the via is IP of openwrt router)

Enjoy a shielded subnet without double NAT :wink:

Be aware, once you remove the phone you'll need to do it again.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.