This guide is meant as an extension to the “Relaying internet access to the Pi Zero 1.3 over USB” document written by the SeedSigner team.
The following steps guide you through the necessary commands and configuration changes needed for the creation of a Rpi Zero v1.3 Ethernet Gadget, specifically on Linux.
Grab a cup of and let’s get started!
1. Make sure you have your MicroSD card flashed with the image given at the start of the Manual Installation Instructions. This can be done using the disks tool. Select the drive that corresponds to your memory card, click on the three vertical dots, then Restore Disk Image. Don’t eject the SD card after completion!
2. Follow the steps detailed here. Stop after editing the cmdline.txt file.
3. Set a static IP address for your USB Network device by configuring your address in Raspbian via dhcpcd. To do this, you need to edit the dhcpcd.conf file:
4. Eject the MicroSD card and insert it into you rpi0. The rest of the commands will be executed on our HOST machine.
ifconfig and take note of the output. We will use this to find our rpi0 Interface name later on.
6. Connect your rpi0 to your machine and wait for ~1 minute.
lsusb to see if your rpi0 is properly connected. Look for
ifconfig again and notice any changes compared to the last time you ran the command. The USB interface should begin with en, looking something like
enxaef9489ed5c4. Otherwise, look for
usb1 and so on.
9. Next we need to configure our local computer’s USB ethernet to use the IP address of our HOST.
Important: Make sure to substitute the IP address and the Interface name with the correct ones.
10. You should now be able to ssh into your Raspberry Pi using raspberrypi.local like this:
We can now talk to our rpi0! The last thing we have to do is give it access to the outside world, not just us.
11. Enable IP forwarding and masquerading on your HOST:
12. To check if you were successful in your last step, you need to
ping a website. SSH into your rpi0, like you did in step 10, and:
If the response you get looks something like this:
Congrats! Your Raspberry Pi Zero has now access to the internet.
Note that these changes are not permanent. You will have to start again from Step 5, every time you reconnect your rpi0.