Connect Linux to an Android phone's VPN
No client is needed on Linux. The Android phone becomes the VPN with HamNet and creates the network; Linux joins it and points the system proxy or the http_proxy variables at HamNet's address — apt, curl, the browser and the rest go through the phone's tunnel.
What you need
An Android phone (8.0+) with HamNet and a VPN link from your provider or your own server. The phone becomes the VPN and opens the hotspot or Wi-Fi Direct network itself; the second device only joins that network and takes the proxy address — no app, no account, no root.
Linux
- Join HamNet's network.
- Settings → Network → Network Proxy → Manual.
- HTTP Proxy and HTTPS Proxy: HamNet's address, port 8181.
- In a terminal:
export http_proxy=http://ADDR:8181 https_proxy=http://ADDR:8181
Three steps
Paste the link
Paste your VPN link or subscription into HamNet and tap Connect VPN. Android asks once to allow the VPN.
Turn sharing on
HamNet makes a Wi-Fi Direct network, or opens a hotspot when Wi-Fi is off, and shows a QR code. Switch Wi-Fi off or on and it moves along with you.
Connect the other device
Scan the first QR with the camera to join the network. An Android phone with HamNet: one tap, done. Everything else: the second QR opens the setup page — iPhone and Mac get a one-tap profile, Windows a PAC link.
Install HamNet on the Android phone
APK · version 2.5.1 · free
Related questions
Does the second device need a VPN or an app?
No. iPhone, Mac, Windows, Linux, TVs and consoles only need a proxy setting (or the one-tap profile/PAC). A second Android phone can install HamNet itself: one tap joins the host and every app on that phone goes through the tunnel.
Which apps go through the tunnel?
Anything that honours the system proxy: browsers, most messaging and streaming apps, app stores. UDP apps (some games, voice calls) may not.
Is the other devices' traffic encrypted?
Between the device and the phone, HTTPS stays HTTPS; from the phone to your server it is inside the VPN tunnel. HamNet stores or sends nothing.
Guides for other devices
Android / tablet · iPhone / iPad · Mac · Windows 10 / 11 · Android TV / smart TV · PlayStation 4 / 5