USB Relay Linux Docs Update

This commit is contained in:
nicklyk
2022-04-07 13:07:10 +02:00
parent aed3c484c3
commit 30e31e1bf7
3 changed files with 89 additions and 1 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+89 -1
View File
@@ -26,7 +26,7 @@ type nul > ssh
```
Now we have some incomprensible configuration steps to set up the internet access relay.
Now we have some incomprehensible configuration steps to set up the internet access relay.
Edit `config.txt`:
```
@@ -63,6 +63,7 @@ blah blah rootwait modules-load=dwc2,g_ether [possibly more blah]
Exit and save changes (CTRL-X, then "y" in nano).
If you are on Linux, you need to first [set a static IP](#set-a-static-ip-on-linux) for both your Pi Zero 1.3 and your host computer. Otherwise, continue with the steps below.
Eject the SD card and insert it into your Pi Zero 1.3. Plug a USB cable into your computer and into the Pi's USB connector that is closer to the center. It will draw power from the USB cable and begin powering up.
@@ -85,6 +86,7 @@ Are you sure you want to continue connecting (yes/no/[fingerprint])?
At the password prompt enter the Pi's default password: `raspberry`
If you now see the Pi's command prompt, you're in!
<img src="img/usb_relay_01.png">
Notice this warning in particular:
@@ -139,6 +141,92 @@ If you see a ping response, the Pi has internet access!
see: https://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/
### Linux
To enable IP forwarding on your Host:
```
nano /etc/sysctl.conf
```
and uncomment the following line:
```
net.ipv4.ip_forward = 1
```
Then run `sudo sysctl -p` to have immediate effect.
You should now be able to SSH into your internet connected Pi Zero 1.3, as described in the ["Get started"](#get-started) section.
## Set a static IP on Linux
_This guide is intended for Debian/Ubuntu based distros._
In order to set up the connection between your computer and the Pi Zero, you will have to set a static IP on both endpoints of the connection.
What you will need:
* `def_iface` is the Iface of the "default" Destination network. On your __Host__ machine, type `route` to find it.
* `host_ip` is the IP address of your Host on the USB interface. For this guide we will use `192.168.21.20`
* `rpi_ip` is the IP address of your Pi Zero on the USB interface. Use `192.168.21.21`
_Note: Remember to remove the brackets. For example, `ip_address=<rpi_ip>` should be written as: `ip_address=192.168.21.21`_
#### On the SD card
```
cd rootfs/etc
nano dhcpcd.conf
```
At the end of the file, add the following lines.
```
interface usb0
static ip_address=<rpi_ip>/24
static routers=<host_ip>
static domain_name_servers=8.8.8.8 8.8.4.4
```
Eject the SD card and insert it into your Pi Zero 1.3. Plug a USB cable into your computer and into the Pi's USB connector that is closer to the center. It will draw power from the USB cable and begin powering up.
#### On the Host machine
Type `lsusb` to see if your Pi Zero is properly connected. Look for `Ethernet/RNDIS Gadget`:
![Static IP on the seedsigner Interface](img/usb_relay_linux_01.png)
Set a name for your new Interface:
```
nano /etc/systemd/network/10-rename-rpi0.link
```
Now paste in the following text:
```
[Match]
Property=ID_VENDOR_ID=0525 "ID_MODEL_ID=a4a2"
[Link]
Name=seedsigner0
```
To give your Host a static ip:
```
nano /etc/network/interfaces.d/seedsigner
```
Now paste in the following text:
```
auto seedsigner0
iface seedsigner0 inet static
address <host_ip>
netmask 255.255.255.0
post-up /sbin/iptables -t nat -A POSTROUTING -o <def_iface> -j MASQUERADE
```
Reboot your computer.
To see if everything is set up correctly, type `ifconfig` and look for the `seedsigner0` interface. It should have the <host_ip> assigned to it.
![Static IP on the seedsigner Interface](img/usb_relay_linux_02.png)
Continue by configuring your host computer to [share internet access](#linux) with your Pi Zero.
## Complete the setup
Return to the main [README](../README.md) and complete the setup steps. But remember to come back here and disable internet access over USB on your SeedSigner.