I want to use the phone as backup line for my Linux server. Can I do this by using the adb? I mean forward everything to a socket and route the traffic there. I also need some port forwarding, would be great if it could be transparent. Or do I have to use the tether option on the phone and configure a interface? Cheers


First you need to make sure that your phone has a public IP so that it's accessible from internet (which is usually not the case). Otherwise port forwarding doesn't make sense. See How to connect to Android over 3G/4G public IP?

Using Android phone as a USB modem+router is rather simple. That's what we do by turning on WiFi hotspot or USB tethering. On rooted phones Port forwarding works by adding DNAT firewall rules. On non-rooted phones you can use adb or netcat or apps like Fwd (ports under 1024 cannot be forwarded though). For details see How to port-forward internet using android Hotspot to PC?

However transparently forwarding all traffic (and not specific ports) to Linux server - using Android as USB modem only - is complex (it won't work without root access). It works by manipulating network routing (tables and RPDB) on Android and optionally on connected host. See How to assign Mobile Data's public IP to host connected on hotspot?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.