Unlike Windows 10, Ubuntu does not allow you to run Wi-Fi and a portable hotspot simultaneously. This may not be an issue when connected to your home Wi-Fi network. However, when you move to a cafe, airport, or hotel where internet connection is limited to one device per user, things can get a bit tricky. However, I recently discovered an app for Linux that lets you share your laptop’s Wi-Fi via ADB. Let’s see how to do this.
This application allows you to share Ubuntu WiFi with Android
“Gnirehtet” is an open source application created by the company that developed ScrCpy – Genymobile. The app works via ADB and so you may need to connect your Android device to your laptop via a USB cable. The app uses the Reverse Tethering option through the “adb reverse” command introduced in Android 5.0. In simple words, it sends web requests on Android to web server through laptop. So the web server thinks the request is made by the laptop itself. This way the laptop is used as a proxy.
For Gnirehtet to work you will need to have ADB installed on Ubuntu. Use the following command to do this.
sudo apt-get install adb
Once ADB is installed, download the Gnirehtet zip file for Linux. Note that there are two different flavors: Linux and Rust. Use Rust because it doesn’t require setting up a Java runtime environment.
After downloading the zip file, extract it. You will see two files inside – the compiled Rust file and the APK file. The APK file must be installed on the Android device. Now you can either send the APK file to your Android device and install it, or use the Gnirehtet command to do it automatically.
Enable USB debugging on your Android device
But before running the command, connect your Android device to your laptop and enable USB debugging through developer options on your Android phone. Next, navigate to the extracted Gnirehtet folder to run the following command.
After the successful installation of the application, run the following command on your computer to start sharing the Wi-Fi connection.
You will also receive a prompt on Android to accept the creation of VPN by Gnirehtet. This is because Gnirehtet transfers data from your Android device to your laptop through a VPN channel.
This method works with several Android devices. Although I haven’t tested it so far, it seems to work fine with two Android devices simultaneously. However, when multiple devices are connected to your laptop, you need to add the adb number of the device with the run command. To find the device number, use the following adb command.
Then, use the serial number to start connecting the internet to a particular Android device.
./gnirehtet run 27f42c49df217ece
Now ADB can also work over Wi-Fi, but it still requires connecting your device with a USB cable for the initial setup. Therefore, I ignore that particular part. For more issues or questions, let me know in the comments below. Check How to Easily Run Linux on Android Devices