Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.13k stars 565 forks source link

Unsure if Internet is passing through #125

Closed mfe7 closed 6 years ago

mfe7 commented 6 years ago

My objective is to communicate between an Ubuntu PC and an Android device via USB. Typically to verify if two devices can communicate I'd ping the other device's IP address from a device, and vice versa.

In this case I'm not sure what the IP addresses are, but I am guessing from the terminal output that it's 10.0.0.2 and 35.163.66.147 or 8.8.8.8.

mfe@mfe-ubuntu:~/Downloads/gnirehtet-java$ ./gnirehtet run
2018-07-11 17:53:09.030 I Gnirehtet: Checking gnirehtet client...
2018-07-11 17:53:09.030 I Gnirehtet: Starting relay server...
2018-07-11 17:53:09.036 I Relay: Relay server started
2018-07-11 17:53:09.131 I Gnirehtet: Starting client...
Broadcasting: Intent { act=com.genymobile.gnirehtet.START cmp=com.genymobile.gnirehtet/.GnirehtetControlReceiver }
Broadcast completed: result=0
2018-07-11 17:53:09.500 I TunnelServer: Client #0 connected
2018-07-11 17:53:09.781 I TCPConnection: TCP 10.0.0.2:48726 -> 35.163.66.137:80 Open
2018-07-11 17:53:09.782 W TCPConnection: TCP 10.0.0.2:48726 -> 35.163.66.137:80 Unexpected first packet -2144174403; acking -1721583842; flags=25
2018-07-11 17:53:09.783 I TCPConnection: TCP 10.0.0.2:48726 -> 35.163.66.137:80 Close
2018-07-11 17:53:11.356 I UDPConnection: UDP 10.0.0.2:44564 -> 8.8.8.8:53 Open
2018-07-11 17:53:11.758 I UDPConnection: UDP 10.0.0.2:31907 -> 8.8.8.8:53 Open
2018-07-11 17:53:12.023 I TCPConnection: TCP 10.0.0.2:56157 -> 35.163.66.137:80 Open

While the script is running, on the Android, I can do ping 10.0.0.2 and get responses in 0.2ms, and on Ubuntu I can do ping 8.8.8.8 and get responses in 5.8ms. However if I ping 8.8.8.8 on the Android I get a bunch of W Router: Dropping invalid packet warnings and no responses. When I ping 8.8.8.8 on Ubuntu, I get no responses but also no warnings. This lack of bi-directional pinging would normally tell me the communication is not succeeding, but I am a beginner to Android.

My main question is: is this the right way to determine if the connection is working?

Other questions: What is the 35.163.66.147 address associated with TCP, and why can't I ping it from either end? Right now I'm using an x86 desktop, but will this code work on an ARM processor?

Overall, I don't actually care about passing the internet through USB (i.e. sharing ability to reach google.com) - I just want the two devices to be on the same network so I can communicate with ROS, where a prerequisite is to establish communication from each device to the other. Not sure if such a use case is best addressed by this package.

rom1v commented 6 years ago

My objective is to communicate between an Ubuntu PC and an Android device via USB.

This tool will only allow to open connections from your Android to your computer. The device and the computer won't be on the same network.

mfe7 commented 6 years ago

Thanks