Genymobile / gnirehtet

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

Can't connect to internet #35

Closed brauliomdutra closed 7 years ago

brauliomdutra commented 7 years ago

Hi,

I'm having problems trying to reverse tether my android device (Galaxy S4 i9505, Lineage OS 14.1). I have enabled USB debugging, installed Android Debug Tools, the latest JRE, and Git Bash on Windows, extracted the gnirehtet files on the same folder as adb, manually installed the apk via cmd.exe, and am currently using a batch file to automatically start the relay server and client. The key icon appears on my device, and a whole lot of TCP and UDP connections show up on my command prompt window.

However, internet connection on my device is not established, for any app. I had a feeling WhatsApp might not work because I'm using my company workstation to reverse tether and they block IPs from them, but even things like opening the Google web page on Chrome don't work.

Attached is the logcat initiated just before starting the relay and client connections, and opening the Chrome app and trying to connect to UOL (news website) and Google. Does this help?

adb reverse --list tells me reverse forwarding is enabled: (reverse) tcp:31416 tcp:31416 netstat -na | find "31416" tells me the relay server is listening: TCP 127.0.0.1:31416 0.0.0.0:0 LISTENING

Thanks!

logcat.txt

rom1v commented 7 years ago

Could you also post the logs of the relay server? Are they (almost) empty?

Just to be sure: did you upgrade from 1.1.0 to 1.1.1 without reinstalling the apk?

brauliomdutra commented 7 years ago

No, I've just recently found out about gnirehtet, so I had only installed the latest (1.1.1).

Excuse my inexperience, but how do I print the relay server logs?

rom1v commented 7 years ago

On Windows, the relay server logs are printed in the window entitled "gnirehtet_relay_server" when gnirehtet is started.

The first line should look like

2017-06-21 17:57:01.782 I Main: Starting server...

IIRC, if you select the content, then right-click, you should be able to paste it somewhere.

brauliomdutra commented 7 years ago

Ok, I cleared logcat, started the relay and client connections, and tried connecting to UOL and Google again, this time saving in "long" format to organize things a bit, like this:

adb logcat -v long > logcat.txt

Also saved the logs from the relay server. Both are attached below.

logcat.txt relaylog.txt

rom1v commented 7 years ago

In your relay server logs, we can see that all TCP connections fail:

2017-06-21 14:19:18.302 E TCPConnection: TCP 10.0.0.2:51257 -> 157.240.12.9:443 Cannot finish connect

Your network probably requires to use a proxy.

Here is how you can configure proxy settings in Android: https://github.com/Genymobile/gnirehtet/issues/4#issuecomment-292917846 More details about (lack of) proxy in gnirehtet: https://github.com/Genymobile/gnirehtet/issues/27#issuecomment-296404498

brauliomdutra commented 7 years ago

Great, that was exactly it!

For future reference, I found out the proxy being used on my corporate computer using this command (on Windows, with admin privileges), after opening a webpage on IE:

netstat -ban

Look for the iexplore.exe process and the proxy will be under the foreign addresses.

Thank you for you assistance!