如何与Linux共享Android VPN?

如何与Linux共享Android VPN?

我有一台安装了 Android 7 的 root 版 Galaxy note5,以及一台安装了 Ubuntu 16.04 的华硕笔记本电脑。我喜欢与我的笔记本电脑共享我的手机 VPN 连接。我尝试了一些应用程序,如 VPNTether、DF tethering fix、TetherNet、Pdanet+ 等,但它们不起作用!

我想我可以在 Windows 10 上使用 VPNTheter 并且它可以工作,但它们不能在 Ubuntu 上工作!

我还测试了两种 Wi-Fi 和 USB 电缆方法。

我也找到了这个方法,但无法理解它在数字 6 和 7 中说的是什么?

  1.  You need a rooted device
  2.  Make sure you have a VPN app, like OpenVPN or DroidVPN ( I use DroidVPN and its the best)
  3.  Download Terminal Emulator
  4.  Activate your hotspot and connect to your VPN
  5.  Launch Terminal emulator and on the first line type "su" (without the quotes) and press enter

  6. Copy and paste this to the Terminal Emulator. Make sure to paste to a new folder using Root Browser first and copy to T.E. in the exact format as shown below:

iptables -t filter -F FORWARD
iptables -t nat -F POSTROUTING
iptables -t filter -I FORWARD -j ACCEPT
iptables -t nat -I POSTROUTING -j MASQUERADE
ip rule add from 192.168.43.0/24 lookup 61
ip route add default dev tun0 scope link table 61
ip route add 192.168.43.0/24 dev wlan0 scope link table 61
ip route add broadcast 255.255.255.255 dev wlan0 scope link table 61

  7. That's about it. Also, be sure to make a folder with Root Browser and paste the code there, as this resets after re-boot. It worked on my LG G3 on android 4.4.2

答案1

首先从 Google Play 商店安装 Proxoid。它是一个迷你代理服务器。它不需要根。安装 Proxoid 后,下载适用于 Linux 的 ADB(Android 调试桥)。然后将其解压到一个空文件夹中。现在在您的 Android 上打开 Proxoid,并通过勾选复选框来启动代理服务器。现在通过 USB 电缆将您的 Android 设备与您的电脑连接起来。现在打开一个终端会话到adb保存指定文件的文件夹。现在以标准用户身份执行这些命令:

./adb tcpip 5555

现在拔掉 USB 电缆。现在在您的 Android 上启动 wifi 热点。现在将您的 PC 连接到网络并执行:

./adb connect 192.168.43.1:5555

请注意,当 android 创建 wifi 热点时,您的手机在该网络中的 IP 地址通常是192.168.43.1。但也有可能是其他情况。因此,如果上述命令不起作用,请更改192.168.43.1为该网络内适当的 IP 地址。现在执行这些命令:

./adb forward tcp:8080 tcp:8080

现在配置您的系统以使用http://本地主机:8080作为代理服务器。请注意,执行第一个命令一次后,直到重新启动 PC 或 Android 设备后才需要执行它。如果你想通过USB线连接,你只需要执行最后一条命令。

答案2

这些命令适用于我的手机(Android 9)。你可以使用root explore或mt Brown之类的应用程序(中国的应用程序,在google play中找不到),

  • 创建一个新文件any-name.sh,例如
  • 将代码复制到文件中,
  • 连接到 VPN 后运行该文件。

在此输入图像描述

相关内容