Project

General

Profile

DeprecatedReplicant60USBNetworking » History » Version 8

Wolfgang Wiedmeyer, 03/17/2017 11:03 AM
clarify how the name of the connection can be changed

1 1 Wolfgang Wiedmeyer
h1. Replicant USB Networking
2
3 2 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 1 Wolfgang Wiedmeyer
5 4 Wolfgang Wiedmeyer
h2. Replicant 6.0
6 1 Wolfgang Wiedmeyer
7 4 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 1 Wolfgang Wiedmeyer
Make sure to have [[ADB]] installed and to have the host daemon running as root.
9
10 5 Wolfgang Wiedmeyer
h3. Preparing the device
11 1 Wolfgang Wiedmeyer
12 5 Wolfgang Wiedmeyer
Push the script on the device, make it executable and run the first part of the script:
13
14 1 Wolfgang Wiedmeyer
<pre>
15 4 Wolfgang Wiedmeyer
adb push usb_networking_device.sh /data/
16
adb shell chmod a+x /data/usb_networking_device.sh
17 1 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start1
18
</pre>
19
20 5 Wolfgang Wiedmeyer
h3. Setting up the connection on the PC
21 1 Wolfgang Wiedmeyer
22 5 Wolfgang Wiedmeyer
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 8 Wolfgang Wiedmeyer
3. Save the connection, preferably with a distinguishable name (The name can be changed at the top of the edit window).
33 5 Wolfgang Wiedmeyer
4. Select this connection for your device.
34 3 Wolfgang Wiedmeyer
5. Now run the second part of the script on the device:
35 1 Wolfgang Wiedmeyer
36 4 Wolfgang Wiedmeyer
<pre>
37 1 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start2
38
</pre>
39
40 5 Wolfgang Wiedmeyer
The connection should now work.
41 1 Wolfgang Wiedmeyer
42 5 Wolfgang Wiedmeyer
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 1 Wolfgang Wiedmeyer
<pre>
49
adb shell /data/usb_networking_device.sh stop
50
</pre>
51 4 Wolfgang Wiedmeyer
52 1 Wolfgang Wiedmeyer
h3. Known issues
53 4 Wolfgang Wiedmeyer
54 5 Wolfgang Wiedmeyer
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 6 Wolfgang Wiedmeyer
58
h2. Replicant 4.2
59
60
h3. Using reverse_tether.sh
61
62
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
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
<pre>
65
./reverse_tether.sh rndis
66
./reverse_tether.sh nat
67
</pre>
68
69
h3. Using the Replicant USB Networking scripts
70
71 7 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 6 Wolfgang Wiedmeyer
However, you can avoid the host part if your network manager can manage a shared connection.
73
74
Make sure to have installed [[ADB]] and to have the host daemon running as root.
75
76
Push the device part on the device and make it executable:
77
<pre>
78 7 Wolfgang Wiedmeyer
adb push usb_networking_device.sh /data/
79
adb shell chmod a+x /data/usb_networking_device.sh
80 6 Wolfgang Wiedmeyer
</pre>
81
82
*Using a network manager shared connection*
83
84
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
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 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start1 dhcp
89 6 Wolfgang Wiedmeyer
</pre>
90
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
5. Now run the second part of the script on the device:
92
<pre>
93 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start2 dhcp
94 6 Wolfgang Wiedmeyer
</pre>
95
96
The connection should now work. To disconnect the device, run:
97
<pre>
98 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh stop
99 6 Wolfgang Wiedmeyer
</pre>
100
101
*Using the host script*
102
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
<pre>
106 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start1 static
107 6 Wolfgang Wiedmeyer
</pre>
108
3. Wait for the interface to show up
109
4. Configure the device interface:
110
<pre>
111 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh start2 static
112 6 Wolfgang Wiedmeyer
</pre>
113
5. Configure the host interface:
114
<pre>
115 7 Wolfgang Wiedmeyer
sudo ./usb_networking_host.sh start
116 6 Wolfgang Wiedmeyer
</pre>
117
118
The connection should now work. To disconnect the device, run:
119
<pre>
120 7 Wolfgang Wiedmeyer
adb shell /data/usb_networking_device.sh stop
121 6 Wolfgang Wiedmeyer
</pre>
122
Cleanup the host:
123
<pre>
124 7 Wolfgang Wiedmeyer
sudo ./usb_networking_host.sh stop
125 6 Wolfgang Wiedmeyer
</pre>