Project

General

Profile

USBNetworking » History » Version 17

Wolfgang Wiedmeyer, 03/17/2017 10:43 AM
add Replicant 6.0 instructions

1 9 Paul Kocialkowski
h1. Replicant USB Networking
2
3 17 Wolfgang Wiedmeyer
This page explains how to connect your Replicant device to the Internet via an USB connection to a computer connected to the Internet.
4 14 Paul Kocialkowski
5 17 Wolfgang Wiedmeyer
h2. Replicant 6.0
6 1 Paul Kocialkowski
7 17 Wolfgang Wiedmeyer
Replicant USB Networking requires a script: "usb_networking_device.sh":https://git.replicant.us/replicant/user-scripts/raw/replicant-6.0/networking/usb/usb_networking_device.sh
8
Make sure to have [[ADB]] installed and to have the host daemon running as root.
9
10
h3. Preparing the device
11
12
Push the script on the device, make it executable and run the first part of the script:
13
14
<pre>
15
adb push usb_networking_device.sh /data/
16
adb shell chmod a+x /data/usb_networking_device.sh
17
adb shell /data/usb_networking_device.sh start1
18
</pre>
19
20
h3. Setting up the connection on the PC
21
22
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.
23
24
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.
25
26
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.
27
28
The following steps are required to set up a new network connection for the device:
29
30
1. In the network manager applet, create a new "Ethernet" or "Wired" connection.
31
2. In the tab for IPv4 settings, select the method "Shared to other computers".
32
3. Save the connection, preferably with a distinguishable name
33
4. Select this connection for your device.
34
5. Now run the second part of the script on the device:
35
36
<pre>
37
adb shell /data/usb_networking_device.sh start2
38
</pre>
39
40
The connection should now work.
41
42
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.
43
44
h3. Stopping the network connection
45
46
To disconnect the device, run:
47
48
<pre>
49
adb shell /data/usb_networking_device.sh stop
50
</pre>
51
52
h3. Known issues
53
54
Some apps won't connect to the Internet if cellular data is disabled. This also affects the latest version of F-Droid (see "this issue":https://gitlab.com/fdroid/fdroidclient/issues/816). 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.
55
56
If you are not able to enable cellular data, you will have to downgrade F-Droid to version 0.101 to make it usable.
57
58
h2. Replicant 4.2
59
60
h3. Using reverse_tether.sh
61
62 15 Paul Kocialkowski
The @reverse_tether.sh@ script is part of AOSP and can be downloaded from: "reverse_tether.sh":https://raw.github.com/CyanogenMod/android_development/cm-10.1/scripts/reverse_tether.sh
63 1 Paul Kocialkowski
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:
64 15 Paul Kocialkowski
<pre>
65
./reverse_tether.sh rndis
66 1 Paul Kocialkowski
./reverse_tether.sh nat
67
</pre>
68 15 Paul Kocialkowski
69 17 Wolfgang Wiedmeyer
h3. Using the Replicant USB Networking scripts
70 15 Paul Kocialkowski
71 17 Wolfgang Wiedmeyer
Replicant USB Networking requires two scripts: "usb_networking_device.sh":https://git.replicant.us/replicant/user-scripts/raw/replicant-4.2/networking/usb/usb_networking_device.sh "usb_networking_host.sh":https://git.replicant.us/replicant/user-scripts/raw/replicant-4.2/networking/usb/usb_networking_host.sh
72 1 Paul Kocialkowski
However, you can avoid the host part if your network manager can manage a shared connection.
73
74 15 Paul Kocialkowski
Make sure to have installed [[ADB]] and to have the host daemon running as root.
75 1 Paul Kocialkowski
76 15 Paul Kocialkowski
Push the device part on the device and make it executable:
77
<pre>
78 17 Wolfgang Wiedmeyer
adb push usb_networking_device.sh /data/
79
adb shell chmod a+x /data/usb_networking_device.sh
80 1 Paul Kocialkowski
</pre>
81
82 17 Wolfgang Wiedmeyer
*Using a network manager shared connection*
83 15 Paul Kocialkowski
84 1 Paul Kocialkowski
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.)
85 15 Paul Kocialkowski
2. Disconnect any other network connections (Wifi, 3G data) on the device.
86
3. Run the first part of the device-side script:
87
<pre>
88 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start1 dhcp
89 12 Paul Kocialkowski
</pre>
90 1 Paul Kocialkowski
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).
91 15 Paul Kocialkowski
5. Now run the second part of the script on the device:
92 1 Paul Kocialkowski
<pre>
93 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start2 dhcp
94 1 Paul Kocialkowski
</pre>
95 15 Paul Kocialkowski
96 1 Paul Kocialkowski
The connection should now work. To disconnect the device, run:
97 15 Paul Kocialkowski
<pre>
98 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh stop
99 7 Paul Kocialkowski
</pre>
100 15 Paul Kocialkowski
101 17 Wolfgang Wiedmeyer
*Using the host script*
102 15 Paul Kocialkowski
103
1. Disconnect any other network connections (Wifi, 3G data) on the device.
104
2. Run the first part of the device-side script:
105 1 Paul Kocialkowski
<pre>
106 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start1 static
107 15 Paul Kocialkowski
</pre>
108 1 Paul Kocialkowski
3. Wait for the interface to show up
109 15 Paul Kocialkowski
4. Configure the device interface:
110
<pre>
111 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start2 static
112 15 Paul Kocialkowski
</pre>
113
5. Configure the host interface:
114
<pre>
115 17 Wolfgang Wiedmeyer
sudo ./usb_networking_host.sh start
116 15 Paul Kocialkowski
</pre>
117 12 Paul Kocialkowski
118 15 Paul Kocialkowski
The connection should now work. To disconnect the device, run:
119
<pre>
120 17 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh stop
121 15 Paul Kocialkowski
</pre>
122
Cleanup the host:
123
<pre>
124 17 Wolfgang Wiedmeyer
sudo ./usb_networking_host.sh stop
125 15 Paul Kocialkowski
</pre>