(Android phone got internet access from Ubuntu laptop via cable)
That magical program is Gnirehtet (tethering reversed) available as Android app and GNU/Linux desktop programs. With this program, without root access at all, we can easily share internet access via USB cable from laptop to smartphone by utilizing USB Tethering in reversed mode. Finally, the topology will be phone -> USB -> desktop -> wifi -> internet. I show you here how to do it with Ubuntu 18.04 LTS. Enjoy!
On wifi hotspot sharing: KDE | GNOME | Budgie | File Sharing/SFTP
Why reverse tethering?
There are several strong reasons to do this:
- Saving cost, so you only need internet access on one device (laptop) and do not need to buy data for phone.
- Security, as you do not expose your phone identity when at a public hotspot place.
- Speed, especially if your phone data service is slow while your public hotspot on laptop is fast. Share it, dude.
- Size, so you can download big sized files on phone when your data service is limited but public hotspot is unlimited. For example, to upgrade all Android applications.
My Specification
I use 2 operating systems on 2 different machines:
Laptop:
- Ubuntu 18.04
- Linux kernel 4.15 (default)
- Wifi internet from a public hotspot
Phone:
- Android 6.0, not rooted
- No SIM card (no carrier, no internet access)
- Data, Wifi, and Hotspot options disabled
- USB Debugging support
- USB Tethering support
- A USB cable
1. Obtain Gnirehtet
As I said, Gnirehtet is divided into two parts, one for you phone (.apk) and one for your GNU/Linux desktop (program written in Rust language). Download it here.
2. Install Gnirehtet to Android phone
- Send the gnirehtet.apk file from computer to phone.
- Install the APK file on Android.
3. Install requirements on GNU/Linux
The only requirement according to the official documentation is adb, so:
$ sudo apt-get install android-tools-adb
Note: distros other than Ubuntu should have same package but either with same or different name. For example, Debian's is android-tools-adb, Arch's is android-tools, and so on.
4. Connect to the internet on desktop
Connect your Ubuntu GNU/Linux to a wifi hotspot internet access.
5. Enable USB Debugging on Android
On your phone, on Android system settings, turn on USB Debugging. Usually it is located at Developer section. Do not enable USB Tethering here.
6. Share internet access from desktop
Running:
$ ./gnirehtet run
You should run this command where the executable program located.
Stopping:
Press Ctrl+C on the same Terminal.
7. Accept connection on Android
On your phone, you will see Allow USB debugging? and accept it. You will also see Reverse tethering enabled message notification. This means you are ready to go online on your phone. Oh, and yes, you can give check mark Always allow from this computer so you do not need to tap anymore next time.
8. Go online!
You should see Gnirehtet: Reverse tethering enabled notification on your phone. Your phone should be connected to the net at this point. Try to run Telegram, F-Droid, Orbot, or web browser on Android and see if they can download something.On desktop, on GNOME environment if you have
Succcessful connection would show [VPN] logo on Android's top panel:
And also saying Reverse tethering enabled message:
Hope this will be useful!
This article is licensed under CC BY-SA 3.0.