🛠 Routeur de voyage : installer OpenWrt sur la Zero 2 W
Objectives
Move away from Raspberry Pi OS: the Zero 2 W is officially supported by OpenWrt (64-bit target bcm27xx/bcm2710, device "rpi-zero-2") — the first 64-bit Zero in the range, which unlocks these aarch64 images. Goal: a travel router — the laptop connects via the USB gadget port, the Zero 2 W bridges to the hotel Wi-Fi, and traffic exits behind its own NAT/firewall.
Hardware
- 1 Raspberry Pi Zero 2 W + microSD
- 1 PC for flashing (dd/Etcher) and the USB port for recovery mode
- The venue's 2.4 GHz Wi-Fi network (the card does not see 5 GHz — a 5 GHz-only hotel is unusable as an uplink)
- The OpenWrt image: target bcm27xx/bcm2710, profile "rpi-3" (sysupgrade), version 23.05.x
Complete code
# 1) Télécharger l'image bcm27xx/bcm2710 (profil rpi-3) pour OpenWrt 23.05.x,
# puis flasher la SD :
sha256sum openwrt-23.05.5-bcm27xx-bcm2710-rpi-3-squashfs-sysupgrade.zip
unzip openwrt-*.zip
sudo dd if=openwrt-*.img of=/dev/sdX bs=4M status=progress conv=fsync
# 2) Premier boot : OpenWrt écoute en 192.168.1.1 sur eth0 (ici via g_ether,
# config.txt/cmdline.txt déjà réglés comme au tuto ethernet-gadget) :
ssh root@192.168.1.1
# 3) Config minimale du mode client+AP (uci) :
uci set wireless.radio0.channel='auto'
uci commit wireless
# Interface WAN en client du réseau de l'hôtel (via l'interface Wi-Fi),
# LAN côté gadget USB — puis redémarrer le réseau :
/etc/init.d/network restart
# 4) Sur le laptop : navigateur vers 192.168.1.1 (LuCI) pour piloter le routeur.
Expected verification
"ubus call system board" indicates "model: Raspberry Pi Zero 2 W" and the aarch64 architecture. The laptop connected via USB obtains an IP in 192.168.1.x, "ping 1.1.1.1" exits via the hotel uplink, and LuCI displays the traffic. The benefit for travel: all devices behind the Zero 2 W share a single network identity and a firewall that YOU control.
Common errors
- Taking a 32-bit image "because it's a Zero": the Zero 2 W is the first ARMv8 Zero; the bcm2710 target is aarch64, older ARMv6 images (Zero/Zero W) do not boot correctly.
- 5 GHz uplink: 2.4 GHz radio only — verify that the hotel broadcasts a 2.4 GHz SSID.
- Exhausting the 512 MB by running the router + optional packages: OpenWrt is tailored for this, but Raspberry Pi OS + desktop is not — do not mix tutorials on the same SD card.
- Irrecoverable config loss: no EEPROM, everything is on the SD card — back up /etc/config (uci export) before every change.
- Upstream speed capped: theoretical 35 Mb/s on 802.11n 2.4 GHz, and the single port is shared with power supply — plan for a Y-cable.
Other tutorials for this board
- Premier démarrage de la Zero 2 W sans écran (headless)
- Se connecter au Wi-Fi (et comprendre les limites 2,4 GHz / WPA2)
- Surveiller la température et la fréquence de la Zero 2 W
- GPIO en Python : LED et bouton avec gpiozero
- Le tour de passe-passe « clé USB Linux » : Ethernet sur USB (g_ether)
- Serveur de blocage de pub réseau avec Pi-hole
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash