Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.23k stars 571 forks source link

No access to local network #152

Closed MCMic closed 5 years ago

MCMic commented 5 years ago

My computer is in a part of my house where the wifi is too weak.

So I use gnirehtet to share the ethernet connexion of my computer with my phone. It works great to access internet, but my phone has no access to the local network.

This may be on purpose, or forced by how tethering works, but would it be possible to at least make sure the computer running gnirehtet is available from the phone so that KDE connect can find it?

rom1v commented 5 years ago

The phone should have access to the local network, as seen by the computer which provides the connection. For example, if 192.168.0.5 is reachable from your computer, then it should be reachable from your phone.

(And to access 127.0.0.1 on the host computer, use 10.0.2.2 from the phone.)

MCMic commented 5 years ago

From the terminal on the phone in root, I cannot ping neither 10.0.2.2 or 192.168.1.1.

Pinging 192.168.1.1 from the computer works fine.

rom1v commented 5 years ago

From the terminal on the phone in root, I cannot ping neither 10.0.2.2 or 192.168.1.1.

You cannot ping at all. It can only forward TCP and UDP, not ICMP. But the IP is reachable.

MCMic commented 5 years ago

Oh, that makes it hard to check.

Any idea why KDE connect does not see my computer? It works when I’m on the wifi.

MCMic commented 5 years ago

J’ai essayé d’ajouter manuellement 10.0.2.2 dans les IPs à tester pour KDE connect mais ça semble pas fonctionner (pourtant je suis tombé sur https://mail.kde.org/pipermail/kdeconnect/2016-April/001481.html )

MCMic commented 5 years ago

If I search devices from the computer, it gets weird. I see my phone listed, but if I try to pair with it, I get the request on the computer, and it seems to pair with itself. Is there anything in the way IPs are routed that would cause this situation where my computer confuses my phone with itself?

rom1v commented 5 years ago

Is there anything in the way IPs are routed that would cause this situation where my computer confuses my phone with itself?

Yes, your device is not on the local network, every connections are initiated from the computer. It's like connecting to a server while you are behind a NAT, the server will see your public IP, your private IP is not reachable. Here, the NAT is your computer, your device has no IP on the local network.

MCMic commented 5 years ago

So my device can see the local network but the opposite is not true?

rom1v commented 5 years ago

So my device can see the local network but the opposite is not true?

Correct.

Only connections initiated by the device to the network are possible, not the other way around (but of course, once they are initiated, communication is bidirectional).

MCMic commented 5 years ago

Ok I guess this is where the problem comes from. I’ll wait to see if KDE connect does not add real USB support instead I guess.

Thanks for all the explanations (and for the software of course)