Raspberry Pi OS Trixie now supports USB gadget mode out of the box, allowing users to connect to their Raspberry Pi boards over IP through USB without the need for a router.
My first experience with USB gadget functionality was when I reviewed the Beaglebone Green Wireless SBC in 2016, but for some reason, official support for the Raspberry Pi ecosystem took a lot longer, and it was only officially implemented in Raspberry Pi OS Trixie images dated 20.10.2025 and later through the rpi-usb-gadget package.
It’s been possible to use the USB gadget mode on Raspberry Pi OS for a while, but it was rather convoluted with outdated scripts, manual configuration steps, and platform-specific instructions. The new rpi-usb-gadget package streamlines the process and makes things much easier:
- The Raspberry Pi SBC will present itself as a USB Ethernet device when connected to a PC
- Users can SSH directly using the hostname set in Raspberry Pi Imager without having to configure Wi-Fi or Ethernet
- If your PC has an active internet connection and Internet Connection Sharing (ICS) is enabled, the Raspberry Pi will automatically receive internet access through the USB cable
- A lightweight background service runs automatically switch between standalone mode and ICS-backed networking
So it’s like USB tethering on your phone, but for a Raspberry Pi. It works on Windows, macOS, and Linux.
How well it works depends on your specific Raspberry Pi SBC model, since it must be connected to a USB port that supports OTG (device mode).
| Raspberry Pi model | USB port to use |
|---|---|
| Raspberry Pi Zero, Zero W, Zero 2 W | The micro USB port closest to HDMI — not ‘PWR IN’ |
| Raspberry Pi 4, 5, 500, 500+ | The USB-C port directly on the board |
| Compute Module 5 | The USB-C port on the Raspberry Pi CM5 IO Board |
| Compute Module 4 | Requires additional manual setup and is not auto-configured |
Once gadget mode is enabled, the OTG port will no longer work as a regular USB port and will only function as a USB Ethernet port with power input. In other words, that means keyboards, storage devices, or other peripherals won’t be recognized.
USB gadget mode can be enabled directly from the Raspberry Pi Imager 2.x when you flash the image to a microSD card. On an existing Trixie installation, run the following commands:
|
1 2 3 4 |
sudo apt update sudo apt install rpi-usb-gadget sudo rpi-usb-gadget on sudo reboot |
The implementation is open-source, and you’ll find the code on GitHub.


Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress. We also use affiliate links in articles to earn commissions if you make a purchase after clicking on those links.





And i’d expect with
sudo rpi-usb-gadget off
reverting to normal USB port mode is possible 😁