Turning your Raspberry Pi Zero into a USB Gadget
last major update April 22, 2024
Ethernet Tweaks
Using mDNS/Bonjour Naming
If you don't want to have to remember your Pi's IP address, you don't have to! Jessie Lite includes and automatically enablesavahi which lets you use names like raspberrypi.local
If for some reason its not activated, we have a full tutorial that will help you get set up.
Don't forget, Windows doesn't have native Bonjour support, so download & install Bonjour Print Services!
(check the tutorial above for a link on where/how to install, you only have to do it once)
So, after you get ping'ing working...try
Or for ssh, it's also perfectly fine:
On OS X, open theNetwork tab of SystemPreferences.
Select the existing CDC orRNDIS USB connection to your Raspberry Pi by selecting Manually from theConfigure IPv4 menu. Use192.168.2.1 for theIP Address, and255.255.255.0 for theSubnet Mask. ClickApply to save your changes.
Then, open theSharing tab in System Preferences.
Turn onInternet Sharing to share your existing internet connection from Wi-Fi or ethernet with theCDC orRNDIS Raspberry Pi connection.
Edit your /etc/network/interfaces file on your Pi to match the one below.
# interfaces(5) file used by ifup(8) and ifdown(8)# Please note that this file is written to be used with dhcpcd# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'# Include files from /etc/network/interfaces.d:source-directory /etc/network/interfaces.dauto lo usb0iface lo inet loopbackiface eth0 inet manualallow-hotplug wlan0iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug wlan1iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug usb0iface usb0 inet manual
# interfaces(5) file used by ifup(8) and ifdown(8)# Please note that this file is written to be used with dhcpcd# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'# Include files from /etc/network/interfaces.d:source-directory /etc/network/interfaces.dauto lo usb0iface lo inet loopbackiface eth0 inet manualallow-hotplug wlan0iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug wlan1iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug usb0iface usb0 inet manual
The important lines are:
and also:
allow-hotplug usb0iface usb0 inet manual
allow-hotplug usb0iface usb0 inet manual
Restart your Pi usingsudo reboot, and SSH back in to it using ssh[email protected]. You can then attempt toping google.com.
$ ping -c 5 google.comPING google.com (216.58.219.238): 56 data bytes64 bytes from 216.58.219.238: icmp_seq=0 ttl=55 time=20.975 ms64 bytes from 216.58.219.238: icmp_seq=1 ttl=55 time=20.904 ms64 bytes from 216.58.219.238: icmp_seq=2 ttl=55 time=20.646 ms64 bytes from 216.58.219.238: icmp_seq=3 ttl=55 time=20.401 ms64 bytes from 216.58.219.238: icmp_seq=4 ttl=55 time=20.379 ms--- google.com ping statistics ---5 packets transmitted, 5 packets received, 0.0% packet lossround-trip min/avg/max/stddev = 20.379/20.661/20.975/0.247 ms
$ ping -c 5 google.comPING google.com (216.58.219.238): 56 data bytes64 bytes from 216.58.219.238: icmp_seq=0 ttl=55 time=20.975 ms64 bytes from 216.58.219.238: icmp_seq=1 ttl=55 time=20.904 ms64 bytes from 216.58.219.238: icmp_seq=2 ttl=55 time=20.646 ms64 bytes from 216.58.219.238: icmp_seq=3 ttl=55 time=20.401 ms64 bytes from 216.58.219.238: icmp_seq=4 ttl=55 time=20.379 ms--- google.com ping statistics ---5 packets transmitted, 5 packets received, 0.0% packet lossround-trip min/avg/max/stddev = 20.379/20.661/20.975/0.247 ms
If using Windows, openNetwork and Sharing Center and click onChange Adapter Settings
Right-Click on your internet connection and selectProperties.
Select theSharing tab. Click the checkbox if it is not already checked. Then click onSelect a private network connection and selectPiZero from the dropdown.
Restart your Pi usingsudo reboot, and SSH back in to it using ssh[email protected]. You can then attempt toping google.com.
$ ping -c 5 google.comPING google.com (216.58.219.238): 56 data bytes64 bytes from 216.58.219.238: icmp_seq=0 ttl=55 time=20.975 ms64 bytes from 216.58.219.238: icmp_seq=1 ttl=55 time=20.904 ms64 bytes from 216.58.219.238: icmp_seq=2 ttl=55 time=20.646 ms64 bytes from 216.58.219.238: icmp_seq=3 ttl=55 time=20.401 ms64 bytes from 216.58.219.238: icmp_seq=4 ttl=55 time=20.379 ms--- google.com ping statistics ---5 packets transmitted, 5 packets received, 0.0% packet lossround-trip min/avg/max/stddev = 20.379/20.661/20.975/0.247 ms
$ ping -c 5 google.comPING google.com (216.58.219.238): 56 data bytes64 bytes from 216.58.219.238: icmp_seq=0 ttl=55 time=20.975 ms64 bytes from 216.58.219.238: icmp_seq=1 ttl=55 time=20.904 ms64 bytes from 216.58.219.238: icmp_seq=2 ttl=55 time=20.646 ms64 bytes from 216.58.219.238: icmp_seq=3 ttl=55 time=20.401 ms64 bytes from 216.58.219.238: icmp_seq=4 ttl=55 time=20.379 ms--- google.com ping statistics ---5 packets transmitted, 5 packets received, 0.0% packet lossround-trip min/avg/max/stddev = 20.379/20.661/20.975/0.247 ms
Page last edited April 22, 2024
Text editor powered bytinymce.