diff --git a/docs/img/usb_relay_linux_01.png b/docs/img/usb_relay_linux_01.png new file mode 100644 index 00000000..a300260c Binary files /dev/null and b/docs/img/usb_relay_linux_01.png differ diff --git a/docs/img/usb_relay_linux_02.png b/docs/img/usb_relay_linux_02.png new file mode 100644 index 00000000..a1f7fe55 Binary files /dev/null and b/docs/img/usb_relay_linux_02.png differ diff --git a/docs/usb_relay.md b/docs/usb_relay.md index d636132c..38526571 100644 --- a/docs/usb_relay.md +++ b/docs/usb_relay.md @@ -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! + 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=` 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=/24 +static routers= +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 +netmask 255.255.255.0 +post-up /sbin/iptables -t nat -A POSTROUTING -o -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 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.