Requires a Raspberry Pi with a DWC USB controller.
Should work with Raspberry Pi Zero (v1, v1.3, W, WH, 2 W), A, A+, 3A+, 4B.
Raspi 5 with firmware update sudo rpi-update
is said to work also.
These guides have more details but are not updated for Raspberry Pi OS Bookworm which changed some network configuration related stuff (migrated to NetworkManager?):
Put Raspberry Pi OS Bookworm image on SD Card using Raspberry Pi Imager. Use advanced settings in Imager to enable ssh on the Raspi.
/boot
in the following is the boot partition of the new created SD Card.
It has a fat file system and should be writable from Windows.
Note
Is this step needed?
In /boot/config.txt
add the following last line:
dtoverlay=dwc2as
In /boot/cmdline.txt
Add the option modules-load=dwc2,g_ether
after rootwait
.
Configure Raspi network with fixed IPv4 in firstrun.sh
on boot partition of new
SD Card (disables Network Manager). Put the following before the line
rm -f /boot/firstrun.sh
(Source: thagrol on forums.raspberrypi.com):
cat >/etc/network/interfaces.d/eth0 <<'EOF'
auto eth00
allow-hotplug eth00
iface eth00 inet static
address 169.254.1.1
netmask 255.255.0.0
auto eth0.1
allow-hotplug etc0.1
iface usb0.1 inet dhcp
EOF
cat >/etc/network/interfaces.d/g_ether <<'EOF'
auto usb0
allow-hotplug usb0
iface usb0 inet static
address 169.254.1.1
netmask 255.255.0.0
auto usb0.1
allow-hotplug usb0.1
iface usb0.1 inet dhcp
EOF
A micro USB to USB-A cable should be enough to connect a Raspberry Pi Zero to a host PC and supply it with power at the same time. For When Raspi gets detected as Serial Port device in Windows
- Device Manager > Update Driver > Select manually
- If no Network adapter driver selectable
- Download Windows RNDIS ethernet driver (link found here)
- unpack .cab file, install via device manager > update driver dialog
Now it should be possible to SSH into the Raspi when it is simply conneced to the host computer:
ssh -l <username> 169.254.1.1
Start Menu > type "View Network Connections" > Properties of internet connection > Sharing > check "Allow other network users to connect through this computer's Internet connection". If a drop down is present, select the Raspi's RNDIS/USB Gadget connection there. For me there is no dropdown and connection sharing is not working yet.