1

A bit of background

I have an Android phone, which unfortunately cannot usb-tether while it is connected to the internet (using wifi or mobile data, but it works when the device is not connected to the internet. Wifi and Bluetooth tethering have this problem too). Now I want to connect my PC to the internet using my android phone (using only wired connection).

The unideal solution

I came up with a rather hacky solution which has a minor problem: I compiled gost - a proxy server - for my device (FYI, I used GOOS=linux GOARCH=arm environmental variables to build the binary) and ran the binary on my Android phone on port 8080 (I placed the binary in /data/local/tmp. I ran it the obvious way using adb shell without superuser privileges). Then I used adb forward tcp:8080 tcp:8080 to forward device's port 8080 to my PC's port 8080. After that I used localhost:8080 as a socks5 proxy on my PC and could access the internet.

The problem is that I cannot use certain applications as they don't support connecting through proxy (some of them run on a lower network layer than a socks5 proxy, so there is no way for them to work).

My question

Is there any way to run a VPN server on my Android phone (which conveniently has root access too) and use it like the way I currently do? If so, I'm only interested in solutions using well-maintained opensource software.

2
  • I should say it almost does. But I guess I will need to change the route for using wifi/mobile data (correct me if I'm not right), which makes it (to some extent) inferior to my current unideal solution. But then again, at least it works, although not as easily as I wanted. I would really like to see an easier solution, for which I could not find a suitable implementation, at least in Go. Dec 7, 2020 at 21:33
  • Yes you need to configure interface names and IP addresses in routing according to your setup. Dec 7, 2020 at 22:53

0

Browse other questions tagged .