3

I want to use the phone as a 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 an interface?

1
  • Hi, looks like you changed the question after it received an answer. As a Q&A site, please note that changing a question that invalidates existing answers is frowned upon. Also, adding a new question after it has been answered won't notify existing answers, so it'd be preferred to post a new question and additionally link to this question as additional context.
    – Andrew T.
    Jun 28 at 3:24

1 Answer 1

1

First, you need to make sure that your phone has a public IP so that it's accessible from the 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 an Android phone as a USB modem + router is rather simple. That's what we do by turning on the 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 a 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 a connected host. See How to assign Mobile Data's public IP to a host connected on a hotspot?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .