Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.1k stars 564 forks source link

Gnirehtet disconnected from relay server when ssh forwarded #454

Open nooobcoder opened 1 year ago

nooobcoder commented 1 year ago

In my use cases, two pcs are involded. The story, In my office wifi is not allowed for interns, and gnirehtet simply does not work thru usb in office network. They are doing something smart.

So, I had a remote computer, and did RemoteForward to have adb remotely connected to the remote pc. I had succeess to list the adb device in the remote machine.

But when I run gnirehtet run on the remote machine, it launches the vpn connection, but in a fraction of seconds, it shows Disconnected from relay server.

What should be a possible fix for this?

What I want: I want my remote pc internet to work with my phone connected through ssh forwarding and adb.

When i execute gnirehtet run on the remote machine, these are the logs,

2022-08-08 11:20:16.581 INFO Main: Starting relay server on port 31416...
2022-08-08 11:20:16.581 INFO Main: Checking gnirehtet client...
2022-08-08 11:20:16.581 INFO Relay: Relay server started
2022-08-08 11:20:17.004 INFO Main: Starting client...
Starting: Intent { act=com.genymobile.gnirehtet.START cmp=com.genymobile.gnirehtet/.GnirehtetActivity }
nooobcoder commented 1 year ago

Tagging @rom1v for quick resolution.

nooobcoder commented 1 year ago

@rom1v

rom1v commented 1 year ago

Check the documentation for scrcpy, and replace 27183 by 31416: https://github.com/Genymobile/scrcpy#ssh-tunnel

Note that gnirehtet only supports "reverse tunnel", so there is no option --force-adb-forward like scrcpy.

nooobcoder commented 1 year ago

@rom1v image

I did what you said, but this error gets thrown up, when I have RemoteForwarded default port 31416.

nooobcoder commented 1 year ago

''' 2022-08-11 14:45:52.759 INFO Main: Starting relay server on port 31416... 2022-08-11 14:45:52.759 ERROR Main: Execution error: IO error: Address already in use (os error 98) '''