full-featured ยท monthly quotas ยท always-on
The Pi needs two wifi interfaces: one connects to your upstream internet (STA), the other broadcasts the wifi.tree AP. On a Pi 4, the built-in wifi handles one role and a USB dongle handles the other. A Pi Zero 2 W typically needs a dongle for both.
Use Raspberry Pi Imager to flash Raspberry Pi OS Lite (64-bit) to your SD card. Enable SSH and set a username/password in the imager's advanced settings.
git clone https://github.com/AgentMage/wifi.tree
cd wifi.tree/pi
The Pi implementation uses a virtual AP interface (uap0)
on top of the built-in wifi adapter, and NAT via nftables. The AP subnet
is 10.42.0.0/24 with the Pi at 10.42.0.1.
# Create the virtual AP interface
sudo bash sbin/wifitree-uap0-setup.sh
# Set up traffic shaping (tc/CAKE)
sudo bash sbin/wifitree-shaping.sh
sudo cp lib/*.py /usr/local/lib/wifitree/
sudo cp sbin/wifitree-*.py /usr/local/sbin/
sudo cp sbin/wifitree-*.sh /usr/local/sbin/
# Install systemd service files (see pi/systemd/)
sudo systemctl enable --now wifitree-portal
sudo systemctl enable --now wifitree-webadmin
sudo systemctl enable --now wifitree-accountd
Edit /etc/wifitree/settings.json for operational settings
(leaf TTL, data cap, bandwidth cap) and
/etc/wifitree/portal.json for appearance (title, emoji,
colors, copy). Both are live-reloaded โ no restart needed.
The AP broadcasts wifi.tree. The admin panel runs at
http://10.42.0.1:8090 on your local network. ๐ณ
wifitree-portal โ captive portal HTTP serverwifitree-webadmin โ admin panel on :8090wifitree-accountd โ bandwidth metering, quota enforcementsudo systemctl restart wifitree-portal
# Live terminal dashboard
sudo python3 /usr/local/sbin/wifitree-monitor.py
# CLI user management
sudo python3 /usr/local/sbin/wifitree-admin.py list
/var/lib/wifitree/wifitree.db)The ESP32 version is cheaper, needs no SD card or setup beyond flashing, and works great for most community setups. The Pi version is for operators who want more control and persistent, calendar-month quotas.