PiZero W 1.1 USB gadget in 2025
I was not expecting this to be such a hassle, but it took a lot of trial and error. Here are the steps to get USB-Gagdet working on a RaspberryPi Zero W 1.2 in 2025
TLDR;
- Flash the latest RaspberryPiOS Trixie image
- Update cmdline.txt and config.txt
- remove CM5 from the config
- Add overlay to the cmdline.txt
- Make sure you configure the wifi, since you just need another connection to the Pi to configure the USB network.
- SSH in and create the following:
/etc/network/interfaces.d/usb0
In it, add:
auto usb0
iface usb0 inet static
address 10.0.0.1
netmask 255.255.255.0
The address here is the IP address of the Pi. When configuring the manual IP address on your laptop or desktop — you must set the IP address of your laptop/desktop to 10.0.0.2. The 'router' is the IP of your pi — which in this case is 10.0.0.1
Next, we tell nmcli to add a permanent connection setting:
sudo nmcli connection add type ethernet ifname usb0 con-name usb0 ipv4.method manual ipv4.addresses 10.0.0.1/24 autoconnect yes
Then we need to add a systemD unit to make sure the interface is brought up.
sudo nano /etc/systemd/system/usb0-startup.service
[Unit]
Description=Configure USB Gadget network
After=network.target
Wants=network.target
[Service]
Type=oneshot
ExecStart=/sbin/ip link set usb0 up
ExecStart=/sbin/ip addr add 10.0.0.1/24 dev usb0
[Install]
WantedBy=multi-user.target
sudo systemctl enable usb0-startup.service
sudo systemctl start usb0-startup.service
Reboot.
Then you should be good. It's shame this functionality isn't standard in the headless Trixie builds. It would hve been great to be able to flash an inage then just boot it.
Thomas —