13

I have Ubuntu 16.04 on my PC.

Is there a way to create a wired connection between my PC and smartphone so the smartphone can be connected to internet via the PC?

user68186
  • 37,461

2 Answers2

3

The answer may not work on your phone. The following worked on my phone

My phone was Google Nexus 6P running factory standard Android 8.x Oreo

This process is called USB reverse tethering. Not all phones support it. Some Android phones have to be rooted for this to work. There are some guides in the links below.

  1. https://forum.xda-developers.com/showthread.php?t=2287494
  2. https://www.howtogeek.com/214375/how-to-reverse-tether-an-android-smartphone-or-tablet-to-your-pc/

    You may need an app on your phone. I didn't need it.

  3. https://medium.com/genymobile/gnirehtet-reverse-tethering-android-2afacdbdaec7

My phone is not rooted. This is what I did:

First, find the MAC address of the USB port you will use

Connect your phone to your PC using an USB cable.

  1. Turn USB tethering on in your phone. This will use your phone's mobile data to connect the PC to the Internet. This is not what we want, but this will give us the device address we will use later.
  2. Open the Network Manager edit window from the Network icon on the top right corner.
  3. Highlight the USB connection. It may be called Ethernet Connection 1 or Ethernet Connection 2.
  4. Click on the Edit button and go to the Ethernet tab.
  5. Copy the information in the Device field: enter image description here

  6. Press cancel button to get out of the Network Edit menu. Do not close the Network Connections window yet.

  7. In your phone turn off USB tethering.

Second, setup a new network connection

  1. Click Add in network connections:

    enter image description here

  2. Give the new connection a new name if you want.

  3. Go to the Ethernet tab and paste the device information you copied.

  4. Go to the IPv4 Settings tab and select Shared to other computers: enter image description here

  5. Save and close network connection windows.

Third, Test with your phone

  1. In your phone, turn off mobile data, and WiFi while connected by USB to the PC.
  2. Surf the web and use other Internet connected apps.

It looks like the USB port gets a random Ethernet MAC address every time it is plugged in. If this is the case, you will have to first find the MAC address and then edit the saved settings every time you want to do this.

Hope this helps

user68186
  • 37,461
3

Gnirehtet

I've found this tool to work out of the box.

The name is "tethering" in reverse, see what they did there.

This project provides reverse tethering over adb for Android: it allows devices to use the internet connection of the computer they are plugged on. It does not require any root access (neither on the device nor on the computer). It works on GNU/Linux, Windows and Mac OS.

Currently, it relays TCP and UDP over IPv4 traffic, but it does not support IPv6 (yet?).

Usage is pretty simple:

  • Download a gnirehtet package for your platform. It contains two files: an apk, and an executable.
  • Make sure you can access the phone via adb.
  • Install the apk on the phone.
  • Run the executable on your computer (with the phone connected via USB). You should get a prompt on the phone which you can accept, and then it Just Works.

One tiny caveat is that Android sees the tethered connection as "not wifi", so that if you've configured some apps to only do certain things on wifi (to save on data), you may need to adjust those settings.