-1

I am trying to setup my Pi Zero W as an internet bridge where it connects to existing WiFi hotspots (using its internal WiFi card) from behind a VPN (openvpn) and then shares the network to a Mac via its USB data port. Curious to hear if this is even possible.

cappicone
  • 1
  • 1
  • It is possible, although I wouldn't know the exact implementation; however, I don't know if the RPi Zero is fast enough for serious browsing. – user96931 Feb 05 '20 at 21:00

2 Answers2

0

You want to connect (uplink) the Pi Zero W as client by WiFi to a hotspot and use it as bridge. This isn't possible because using wlan0 as slave interface of a bridge isn't supported by the built-in WiFi chip. For further information of this issue you may have a look at Raspberry Pi WiFi to Ethernet Bridge for a server?. But you can use the RasPi as router. How to setup this you can look at Can a Raspberry Pi Zero W be turned into an USB WiFi dongle to any USB Host like x86 PC or mini-PC?.

Ingo
  • 42,107
  • 20
  • 85
  • 197
0

Yes it's totally possible, the trick is to setup the Pi Zero as a USB Ethernet gadget.

I have a blog post about it here:

https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/

While it talks about Pi4, it also works with Pi Zero's. I also have a project to automatically modify Raspberry Pi OS images:

https://github.com/hardillb/rpi-gadget-image-creator

But the basics are covered by running this script on start up:

#!/bin/bash
cd /sys/kernel/config/usb_gadget/
mkdir -p pi4
cd pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
mkdir -p strings/0x409
echo "fedcba9876543211" > strings/0x409/serialnumber
echo "Ben Hardill" > strings/0x409/manufacturer
echo "PI4 USB Device" > strings/0x409/product
mkdir -p configs/c.1/strings/0x409
echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower
# Add functions here
# see gadget configurations below
# End functions
mkdir -p functions/ecm.usb0
HOST="00:dc:c8:f7:75:14" # "HostPC"
SELF="00:dd:dc:eb:6d:a1" # "BadUSB"
echo $HOST > functions/ecm.usb0/host_addr
echo $SELF > functions/ecm.usb0/dev_addr
ln -s functions/ecm.usb0 configs/c.1/
udevadm settle -t 5 || :
ls /sys/class/udc > UDC
ifup usb0
hardillb
  • 196
  • 12