I’m trying to turn a Pi-Zero W into a USB WiFi dongle but have not found any instructions or much about the possibility. What I have tried hasn’t worked. Now I wonder if it is even possible to route packets to the usb port. Am I wasting my time? Can anyone clear this up?

  • Do you realise you can but a USB WiFi dongle for less than the price of a Pi?
    – Milliways
    Dec 8, 2019 at 3:05
  • This is not about cost, it is about size and capability. Dec 8, 2019 at 3:41
  • 2
    Dongles are smaller and more capable
    – Milliways
    Dec 8, 2019 at 5:14
  • Could you explain in more detail what you try to achieve. You want that your raspberry behaves like a USB network device on the USB side? And on the Wifi side shall it act like a WLAN access point or like a Wifi client connecting to a predefined access point?
    – gelonida
    Dec 8, 2019 at 12:03
  • Yes, that is exactly right. I have the Pi-Zero configured as a USB “RNDIS gadget” and also connected to my WiFi AP, and figure I might as well add WiFi packet routing to usb0. Dec 9, 2019 at 2:37

1 Answer 1


I do not have a Raspberry Pi Zero W available but you can use ethernet gadget mode. Then the usb0 interface behaves like a normal network interface and you can enable ip forwarding. This will forward network traffic between the available network interfaces, in your case wlan0 and usb0. You can enable it with:

rpi ~$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# check with:
rpi ~$ cat /proc/sys/net/ipv4/ip_forward

but this setting is lost on next bootup. To have it persistent you can set it in /etc/sysctl.conf. There you have to uncomment the line:


It is possible that you also have to add/modify the routing table for your configuration to get traffic routed between the networks that the interfaces are connected to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.