Pi-Dock-Wifi: Raspberry Pi 5 DIY Router Deep Dive

Reddit user open-sources Pi-Dock-Wifi router built on Raspberry Pi 5 8GB with dual MT7915E Wi-Fi cards via PCIe switch, USB NVMe

Table of contents
  1. 1.Introduction & Key Highlights
  2. 2.Core Specs & Comparison
  3. 3.Deep Dive & Implementation Details
  4. 3.1.Hardware Topology & PCIe Bandwidth Contention
  5. 3.2.Docker Compose Three-Container Collaboration Model
  6. 3.3.Configuration Management & Self-Healing Engineering
  7. 4.Scenario-Based Selection & Pitfall Checklist
  8. 5.FAQ
  9. 6.Sources & References
Pi-Dock-Wifi: Raspberry Pi 5 DIY Router Deep Dive

Introduction & Key Highlights

Reddit user u/Glittering_Pound1931 recently shared a DIY router project named Pi-Dock-Wifi on r/selfhosted. The core is an 8 GB Raspberry Pi 5. Started during the 2020 pandemic and iterated over several years, the project is now open source. Its hardware aesthetic is distinctly lab-style: exposed PCBs, tower antennas, and 3D-printed brackets. The core value lies in demonstrating how to leverage the Pi 5’s single PCIe lane via a 52Pi B14 PCIe Switch HAT to drive two MediaTek MT7915E wireless cards (split 2.4/5 GHz), complemented by a USB NVMe drive and USB Hub HAT to form a complete soft router. On the software side, Docker Compose orchestrates three containers to deliver hostapd wireless access, dnsmasq DHCP/DNS, firewall routing, a web dashboard, Pi-hole ad blocking, and ttyd web SSH, with built-in health checks and Ethernet self-healing. This article targets operators with Linux networking and Docker fundamentals, dissecting the hardware topology, container orchestration details, and engineering trade-offs for reference when building a custom gateway.

Core Specs & Comparison

Dimension Key Spec / Implementation Notes & Limitations
Core Compute Raspberry Pi 5 (8 GB RAM) Single PCIe 2.0 x1 lane, bandwidth constrained
Wireless Expansion 2× MediaTek MT7915E (MiniPCIe) Requires 52Pi B14 PCIe Switch HAT for lane splitting
Storage USB NVMe SSD + USB Hub HAT Non-native NVMe; boot/IO limited by USB bus
Power Delivery Dedicated power board + 3D-printed mounts Must solve Pi 5 high-load power stability
Container Orchestration Docker Compose (3 services) Main container requires privileged: true + network_mode: host
Core Services hostapd / dnsmasq / routing firewall / Web Dashboard Config files edited directly, not traditional read-only Web UI
Enhanced Services Pi-hole (DNS filtering) / ttyd (Web SSH) Integrated via Dashboard
Ops Features Health checks, traffic stats, logs, Ethernet self-heal Aims to reduce manual intervention; implementation scripts not disclosed in source
Target Scenarios Whole-apartment Wi-Fi, learning lab, highly custom gateway Not plug-and-play; requires kernel driver compatibility & hardware debugging skills

Deep Dive & Implementation Details

Hardware Topology & PCIe Bandwidth Contention

The Raspberry Pi 5 exposes only one PCIe 2.0 x1 lane (theoretical ~5 GT/s, actual throughput limited). Pi-Dock-Wifi uses the 52Pi B14 PCIe Switch HAT to split this into two MiniPCIe lanes, each connecting a Waveshare adapter carrying an MT7915E card. Physically feasible, but both cards share the single lane bandwidth, creating a bottleneck under heavy concurrent dual-band throughput. Storage uses a USB 3.0-to-NVMe bridge, avoiding SD card wear but delivering lower random IOPS and higher latency than native PCIe NVMe. The power board and 3D-printed brackets are non-standard parts; replication requires solving 5 V / 5 A peak current and mechanical vibration resistance. The source does not disclose measured power draw or cooling solution; under sustained load the Pi 5 may throttle, requiring independent stress testing.

Docker Compose Three-Container Collaboration Model

The compose file defines three services: the main pi-dock-wifi container, Pi-hole, and ttyd. The main container is the core and must run with privileged: true and network_mode: host, directly manipulating the host network namespace to drive hostapd AP creation, dnsmasq lease distribution, iptables/nftables forwarding, and exposing the web dashboard port. This design breaks container isolation in exchange for full control of the network stack, but it also means container escape risk equals host root privileges. The Pi-hole container handles upstream DNS filtering only, linked to the main container’s dnsmasq via a custom bridge or host mode. ttyd maps the host SSH into an embedded terminal in the dashboard for web-based emergency troubleshooting. The source does not provide the full docker-compose.yml or Dockerfile; image build details (base image version, kernel module injection, hostapd compile flags) must be reconstructed independently.

Configuration Management & Self-Healing Engineering

The project emphasizes “direct config file edits” rather than a read-only Web UI. Files such as /etc/hostapd/hostapd.conf, /etc/dnsmasq.d/, and firewall rule scripts are mounted as host volumes; changes take effect via systemctl reload or SIGHUP inside the container. For self-healing, the source mentions “health checks, network statistics, logs, Ethernet recovery handling.” It is inferred that a daemon runs inside the main container: periodic pings to gateway/upstream DNS, and on failure resets eth0/wlanX interfaces, reloads dhclient, triggers hostapd restart; complemented by the kernel watchdog module to prevent deadlocks. However, the source does not disclose the actual scripts, thresholds, retry intervals, or whether systemd watchdog is integrated. Production deployment requires filling these gaps and stress-testing fault-injection scenarios (WAN unplug, RF interference, kernel OOM).

Scenario-Based Selection & Pitfall Checklist

  1. Learning / Lab Environment First Choice If the goal is deep understanding of the Linux network stack, hostapd/dnsmasq interaction, and Docker host network mode, this project is an excellent teaching tool. Budget 2–3 weeks for hardware bring-up (PCIe enumeration, MT7915E firmware loading, antenna VSWR tuning).

  2. Home Core Gateway — Use With Caution High single-point-of-failure risk (no Pi 5 redundancy, USB storage prone to disconnect, cooling unresolved). Recommended only as a side-car gateway or isolated lab segment. For core workloads, prefer x86 soft routers (N100/N305 + dual Intel i226) or mature OpenWrt hardware routers.

  3. MT7915E Driver Compatibility Pitfall The card relies on the mt76 kernel module, requiring Linux 6.6+ with specific backported patches. The Pi 5 official Bookworm kernel may lack the firmware mt7915e.bin; it must be pulled manually from the linux-firmware git repo into /lib/firmware/mediatek/ followed by update-initramfs -u.

  4. PCIe Switch HAT Enumeration Order Non-Deterministic The two MiniPCIe slots on the 52Pi B14 may appear with different bus numbers in lspci across boots, causing wlan0/wlan1 to swap between 2.4/5 GHz physical cards. Fix by creating /etc/udev/rules.d/70-persistent-net.rules keyed to MAC addresses, or explicitly specify interface=wlan0_2g etc. in hostapd config.

  5. Privileged Container Security Boundary Main container privileged + host network equals host root. Any container escape vulnerability (e.g., CVE-2024-21626 runc) compromises the entire network. If the dashboard is exposed to the internet, it must be behind WireGuard/Tailscale zero-trust access, disable plain HTTP, and regularly scan the image for vulnerabilities (trivy image pi-dock-wifi:latest).

FAQ

Can this project be replaced by flashing OpenWrt/ImmortalWrt instead of the Docker approach?

The source does not mention OpenWrt adaptation. Official Raspberry Pi 5 OpenWrt snapshots already support PCIe and MT7915E, but the 52Pi B14 Switch HAT’s PCIe bridge topology may be missing from the OpenWrt DTS, requiring custom device-tree patches. USB NVMe boot also needs extra kmod-usb-nvme and block-mount configuration. If a native router firmware experience is desired, the OpenWrt path is viable but development effort is comparable to the existing Docker solution.

What is the real-world throughput ceiling of dual MT7915E sharing PCIe x1?

The source does not disclose measured data. Theoretically PCIe 2.0 x1 single-direction ~4 Gbps, ~3.2 Gbps after protocol overhead. With dual cards aggregating dual-band concurrent traffic, total physical-layer throughput is capped by this bus limit, far below a single card on native PCIe x1. If >1 Gbps wireless throughput is required, consider the Raspberry Pi CM4 IO Board with native PCIe x1 single card, or migrate to an x86 platform.

How to hot-reload hostapd config (e.g., change SSID/password) without restarting the container?

The main container runs in host network mode. After editing the mounted hostapd.conf on the host, execute kill -HUP $(pidof hostapd) or hostapd_cli -i wlan0 reconfigure inside the container to hot-load. If a syntax error crashes hostapd, Docker’s restart: unless-stopped policy will restart the container, potentially entering a restart loop. Adding config validation and a rollback button in the dashboard is recommended.

Sources & References

Spotted outdated pricing, stock, or expired coupons?See methodology & report an update →

Related articles