I have RaspberryPi which connected to Android Phone via USB and USB Tethering is up. Android Phone is connected to Home Router (Wi-Fi). With this setup, my Raspberry Pi can reach the internet with USB-Android Phone-Home Router-Internet path. And I can reach my Raspberry with VX ConnectBot app in Android Phone. What I want to do is, I want to make ssh connection to Raspberry Pi with my laptop (which is also connected to Home Router). IS it possible to redirect incoming wi-fi packets to usb on Android phone?

To be clear, here is the path that I want;

Laptop (ssh connection) -> Home Router -> Android Phone -> USB -> Raspberry Pi

  • Try running a proxy on the phone and then ssh to the Pi through the phone proxy using the IP address of the Raspberry Pi
    – AguThadeus
    Commented May 12, 2017 at 9:29

2 Answers 2


That should be possible and requires a reverse port forward, which can be setup with adb:

Run this command on your Raspberry Pi: adb reverse tcp:<remote> tcp:<local> where <remote> is the TCP port on your android phone and <local> the TCP port on your Raspberry Pi.


adb reverse tcp:2222 tcp:22

Let's say your Android phone has the WiFi IP Now you should be able to connect from your laptop (or any device on the WiFi) to and end up port-forwarded to your Raspberry Pi's ssh on port 22.

You might need to build adb for Raspbian yourself, which is explained here. But recent Raspbian versions should include a recend adb client.

2nd option: you could forward (relay) the ports at the USB tethering subnet - usually 192.168.42.x, where is your Android phone and the Raspberry Pi will have an interface usb0 with the IP address assigned by the Android's DHCP. Understand that once USB tethering is enabled, your phone will have two active network interfaces: wlan0 (which is your WiFi 192.168.1.x as usual) and usb0 (which is 192.168.42.x). You need to know the usb0 IP on your Raspberry Pi, once it's connected to USB tethering. Now to make it all work you would need to use a tool like tcpxd on your Android phone:


Where is your usb0 IP from your Raspberry Pi. Same as option 1: You should be able to connect from your laptop (or any device on the WiFi) to and end up port-forwarded (relayed) to your Raspberry Pi's ssh on port 22.

Both solutions should work without root.

  • Does this work with UDP as well, or is it only TCP?
    – CLOVIS
    Commented Jan 7, 2021 at 14:40

Fwd: port forwarder app can forward both TCP and UDP ports.

The usage is straight forward:

  1. Click the plus to add a new rule
  2. Give it a title
  3. Select protocol (TCP or UDP or both)
  4. Select source interface and port
  5. Provide target IP and Port

However, there are two limitations:

  • You need to know the local IP address of the PC / RaspberryPi which probably changes each time you enable USB-tethering.
  • The app does not create a real port forwarding at IP layer (this would require root privileges). Instead, the incoming data is forwarded to a new stream to the connected PC, similar to socat. This changes the sending IP address which is not acceptable for all use cases.

You must log in to answer this question.

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