Project

General

Profile

Actions

Replicant USB Networking

This page explains how to connect your Replicant device to the Internet via an USB connection to a computer connected to the Internet.

Replicant 6.0

Replicant USB Networking requires a script: usb_networking_device.sh
Make sure to have ADB installed and to have the host daemon running as root.

Preparing the device

Push the script on the device, make it executable and run the first part of the script:

adb push usb_networking_device.sh /data/
adb shell chmod a+x /data/usb_networking_device.sh
adb shell /data/usb_networking_device.sh start1

Setting up the connection on the PC

The network manager applet on your PC (usually accessible through the network icon on your taskbar) should now display the device as a new wired interface. Below the name of the device should be a list of available connections. Depending on your network configuration, the list might be empty or offers one or more entries.

If your PC is connected to the Internet via Ethernet, a connection with the name "Auto-Ethernet" or a similar name could be available. Selecting this option should be enough to configure the connection and you can skip most of the steps below and continue with step 5. If there are issues with your connection, you will have to start again and do the rest of the steps, too.

If your PC uses Wi-Fi and Ethernet-based connections are suggested for your device, selecting one of them will likely not work. You will have to set up a new Ethernet-based connection.

The following steps are required to set up a new network connection for the device:

1. In the network manager applet, create a new "Ethernet" or "Wired" connection.
2. In the tab for IPv4 settings, select the method "Shared to other computers".
3. Save the connection, preferably with a distinguishable name (The name can be changed at the top of the edit window).
4. Select this connection for your device.
5. Now run the second part of the script on the device:

adb shell /data/usb_networking_device.sh start2

The connection should now work.

The new connection is saved on your PC and you don't have to recreate it when connecting the device again. It is then only necessary to run the first part of the script, selecting the network connection for the device in case it is not auto-selected and to run the second part of the script.

Stopping the network connection

To disconnect the device, run:

adb shell /data/usb_networking_device.sh stop

Known issues

Some apps won't connect to the Internet if cellular data is disabled. In other apps, like in the latest version of F-Droid, some parts of the app connect to the internet, while other parts of it do not. (see this issue). A workaround is to enable cellular data before doing the configuration steps for usb tethering. The previously described configuration steps will overwrite the cellular data connection and the connection via USB tethering will be used.

If you are not able to enable cellular data, you will have to downgrade F-Droid to version 0.101 to make it usable.

Replicant 4.2

Using reverse_tether.sh

The reverse_tether.sh script is part of AOSP and can be downloaded from: reverse_tether.sh
In order to start basic NAT networking between the host and the device, make sure to have installed ADB and to have the host daemon running as root. Then, use reverse_tether.sh the following way:

./reverse_tether.sh rndis
./reverse_tether.sh nat

Using the Replicant USB Networking scripts

Replicant USB Networking requires two scripts: usb_networking_device.sh usb_networking_host.sh
However, you can avoid the host part if your network manager can manage a shared connection.

Make sure to have installed ADB and to have the host daemon running as root.

Push the device part on the device and make it executable:

adb push usb_networking_device.sh /data/
adb shell chmod a+x /data/usb_networking_device.sh

Using a network manager shared connection

1. On your Linux PC, in the network manager applet (where you normally set up wired or wireless network connections), create a new "Shared" "Wired" connection, with default settings (connection type = Shared). (This is independent of the device, and only needs to be created once.)
2. Disconnect any other network connections (Wifi, 3G data) on the device.
3. Run the first part of the device-side script:

adb shell /data/usb_networking_device.sh start1 dhcp

4. The device should appear in the host's network manager applet as a new "wired" network connection. Connect this to the "Shared" connection that you created above (it should be in the list of choices given by the applet).
5. Now run the second part of the script on the device:
adb shell /data/usb_networking_device.sh start2 dhcp

The connection should now work. To disconnect the device, run:

adb shell /data/usb_networking_device.sh stop

Using the host script

1. Disconnect any other network connections (Wifi, 3G data) on the device.
2. Run the first part of the device-side script:

adb shell /data/usb_networking_device.sh start1 static

3. Wait for the interface to show up
4. Configure the device interface:
adb shell /data/usb_networking_device.sh start2 static

5. Configure the host interface:
sudo ./usb_networking_host.sh start

The connection should now work. To disconnect the device, run:

adb shell /data/usb_networking_device.sh stop

Cleanup the host:
sudo ./usb_networking_host.sh stop

Updated by dl lud over 4 years ago · 10 revisions

Also available in: PDF HTML TXT