- Tethering device: The device sharing its internet connection.
- Tethered deivce: The device want to connect to the Internet via 'tethering device'.
- Termux: Install from Github.
- Termux-API: Install from Github
- Clone the repository
git clone https://github.com/AlphaBs/termux-gnirehtet
- Run
pkg update && ./install.sh
.
- Make sure USB debugging is enabled on the tethered device.
- Connect two Android devices with USB cable.
- Set USB control mode:
- Tethering device: USB controlled by connected device
- Tethered device: USB controlled by this device
- Allow file system access and USB debugging authorization.
![](https://private-user-images.githubusercontent.com/17783561/365353691-dc9b37b7-104e-4da8-8f13-2294a749ae6a.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMzI4NjMsIm5iZiI6MTcyNjEzMjU2MywicGF0aCI6Ii8xNzc4MzU2MS8zNjUzNTM2OTEtZGM5YjM3YjctMTA0ZS00ZGE4LThmMTMtMjI5NGE3NDlhZTZhLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDA5MTYwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc2NTRmZDE5MjcxZTE3ZWEzNDhlYjQwNDY0NWRlMjAyOWMyYzc1NGY4ZWVmOTJkNzZhMWNjNmFhNmM0Y2M2NjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.I_wTq_dMT0oqbDgLFEY_F58dFiCDNKxS4O4jthDuotI)
- Run
adb devices
on the tethering device to check the tethered device is connected. (it may take 1-2 minutes)
![](https://private-user-images.githubusercontent.com/17783561/365358110-cda5cbf1-c31d-4791-83d3-5253c866078c.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMzI4NjMsIm5iZiI6MTcyNjEzMjU2MywicGF0aCI6Ii8xNzc4MzU2MS8zNjUzNTgxMTAtY2RhNWNiZjEtYzMxZC00NzkxLTgzZDMtNTI1M2M4NjYwNzhjLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDA5MTYwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ3Nzg5NWJmMzhiMDNmMjI3ZWUwODkwODYyOTgxMzYzZWJjODRhYjM0Y2U3YTVmMGE5NDAyMDZmMGJkMTU5NzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GIcw4QwBufn0hhUale-Ah-Uk8ueO-Bt_EAAEgHaege4)
![](https://private-user-images.githubusercontent.com/17783561/365358212-d992c57e-cee8-4177-8678-17937b557004.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMzI4NjMsIm5iZiI6MTcyNjEzMjU2MywicGF0aCI6Ii8xNzc4MzU2MS8zNjUzNTgyMTItZDk5MmM1N2UtY2VlOC00MTc3LTg2NzgtMTc5MzdiNTU3MDA0LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDA5MTYwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0YjEwY2VhZjBkOTBlZmJjMWQyYWI5ODZkZDNkZGU2NTFlMDliZjdiNWU5NmMyOGRjMzM5MGQwMjJlOGM4ZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FOuINlw-wnC3u4fsMOxS1LvnKoMlaIYOGZI-lae9DnU)
- Run
./gnirehtet run
on the tethering device.
![](https://private-user-images.githubusercontent.com/17783561/365358282-dcba643b-60cf-4335-92a9-b558e973e65f.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMzI4NjMsIm5iZiI6MTcyNjEzMjU2MywicGF0aCI6Ii8xNzc4MzU2MS8zNjUzNTgyODItZGNiYTY0M2ItNjBjZi00MzM1LTkyYTktYjU1OGU5NzNlNjVmLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDA5MTYwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlOTQ0NzJhOTUxM2Q3N2QzM2U2NDQ2OWM1NjYxOWIyYWI5MTJhM2E0MWY2YmEzYTUyYWU2YmUwOWQ4YzBiY2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MnDUl7WpyzbME7A-s0EFbJchn3ZZq3vwjtZKy2X10FQ)
gnirehtet
was originally for reverse-tethering, sharing PC's internet connection to Android device, using adb
. I recompiled gnirehtet
to make it executable on aarch64 Termux.
To run adb
and connect to another device on Android, I used termux-adb
.
The binary of relay server (gnirehtet
) in this repository was built for Termux, aarch64
. However, you may want to build relay server yourself to run on difference environment.
To build relay server:
- Install cargo to build Rust.
- Run
build-gnirehtet.sh
script.
The compiled binary (named gnirehtet
) will be located in the same directory where the script is executed.
gnirehtet app would work on most devices so you don't need to build it yourself. The apk file in this repository is from official gnirehtet release.
To build the Android app: gnirehtet/DEVELOP.md