Raspberry Pi 4 USB Ethernet Gadget — Full Setup Guide

📄 Intro

Welcome to IT Homelab Online — in this guide we’ll turn a Raspberry Pi 4 into a USB-Ethernet Gadget. That means your Pi will show up as a wired network adapter when connected to your PC via USB-C.

We’ll configure the Pi so that when plugged in via a USB-C cable, it becomes a network interface at 10.55.0.1, making it ideal for headless homelab setups, portable labs, or secure network environments.


🔧 Prerequisites (What you need)

  • Raspberry Pi 4

  • USB-C cable (data-capable)

  • Raspberry Pi OS installed on SD card

  • A host computer (laptop/desktop) with USB-C/USB-A port

  • Optionally: power via USB-C from host (if host port supplies sufficient power)

⚠️ Note: Use the USB-C port on the Pi — the standard USB-A ports may not work for gadget mode.

📝 Step 1 – Enable USB Gadget Mode on the Pi

  1. Mount the SD card (boot partition) on your PC.

  2. Open /boot/firmware/config.txt and append:

     
    dtoverlay=dwc2
  3. Open /boot/firmware/cmdline.txt. This is a single line — after rootwait, append (on same line):

     
    modules-load=dwc2,g_ether

     

  4. Save and unmount the card.


🔄 Step 2 – Boot & Confirm usb0 Interface

  • Insert the SD card into your Pi and power it (via USB-C from host or external power).

  • Once booted, verify the network interface:

     
    ip a

    You should see usb0 listed as a network interface — this means gadget mode is active. Raspberry Pi Complete Guide+1


🎯 Step 3 – Assign Static IP (Pi side)

To give the Pi a fixed IP (10.55.0.1):

  • On the Pi (or via another interface initially): edit /etc/dhcpcd.conf (or your network config). Add:

     
    interface usb0
    static ip_address=10.55.0.1/24
  • Alternatively, you can use a network manager / udev / startup-script method (as per newer OS changes) to ensure usb0 comes up on every boot. This aligns with updated guides for newer Raspberry Pi OS versions. Raspberry Pi Forums+1

  • Reboot the Pi to apply the configuration.


🔌 Step 4 – Connect Pi to Host (PC/Mac/Linux) via USB-C

  1. Plug the Pi (via USB-C) into your computer.

  2. On the host, you should see a new network adapter (RNDIS/USB Ethernet Gadget).

  3. Assign a static IP on your host in the same subnet — e.g. 10.55.0.2/24.

  4. Test connectivity:

     
    ping 10.55.0.1

    If ping works — connection is successful.


🔐 Step 5 – SSH Into Pi Over USB

With networking working, you can SSH directly:

 
ssh pi@10.55.0.1

Now you have shell access to your Pi over a simple USB-C connection — no extra cables or displays required.


🔄 (Optional) Share Host Internet to Pi

If you want the Pi to access the internet through your host:

  • On Windows / macOS / Linux, enable Internet Sharing / Network Sharing on the USB-Ethernet interface.

  • Once enabled, your Pi will have internet via the USB-C connection, while maintaining the static IP.


⚠️ Notes & Caveats (What to watch out for)

  • On newer Raspberry Pi OS releases (e.g. Bookworm), gadget-ethernet (usb0) may default to down state — you may need additional configuration (Network Manager / udev / startup scripts) to bring it up automatically. Raspberry Pi Forums+1

  • Not all USB-C cables are data-capable — ensure yours supports data transfer.

  • Powering Pi from a laptop USB-C port may or may not provide enough current — depends on host port.

  • Some platforms or OS versions may require additional tweaks for drivers (especially Windows hosts using RNDIS). Adafruit Learning System+1


🧑‍💻 Summary

Using the steps above, you can configure a Raspberry Pi 4 to act as a USB-Ethernet Gadget, appearing as a fixed-IP network adapter (10.55.0.1) when plugged into a host PC via USB-C. This is especially useful for headless homelabs, field setups, portable networking tools, or secure isolated machines — all requiring only a single cable.

If you found this useful, check out the full video walkthrough on YouTube and subscribe for more homelab / Pi-networking builds.

Leave a Comment

Scroll to Top