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?
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.