My programs ·
CPE Box: a router panel and the numbers the kernel hides
A setup script and web panel for the Xiaomi 5G CPE Pro. Why the kernel's byte counters miss 95 % of the traffic and what version 1.0.15 adds on 28 November.

- CPE Box
- Go
- Shell
- 5G
Why this program exists
The stock interface of the Xiaomi 5G CPE Pro (model CB0401V2, sold in Germany as the Magenta Internet Box AX5400) hides many cellular and Wi-Fi settings, and the firmware phones home through telemetry and cron jobs. CPE Box is for people who own the hardware: one script, start.sh or start.ps1, opens persistent SSH access, removes the telemetry and starts a panel at http://cpe.box. It needs no Python and no third-party exploit tool, and the panel is a single native binary.
What was hard
The data counter. The kernel's rx_bytes and tx_bytes and the WAN totals of trafficd are taken after the hardware flow-offload split and miss about 95 % of the traffic. So the panel reads today's and this month's usage from the modem itself (mobile.flowstat.daily_usage), the same numbers the stock interface shows.
A second example is in version 1.0.14: the firmware of the CB0401 v1 (RG520N-EB) reports PCI 0 for the 5G cell in NSA mode. The Connection card read only QENG, while Cells around read the NR measurement report and showed the real PCI. Now both read the report and agree. A user had reported it in the issue tracker.
What version 1.0.15 adds
Version 1.0.15 from 28 November adds a scheduled reboot, also requested in the issue tracker. You set times with days of the week. A fresh start makes the modem register again and pick the cell and bands from scratch, which helps when it sticks to a weaker cell after days of uptime.
- The schedule runs in the router's own cron, so the computer running the panel can be off.
- The panel shows the router's clock, warns when its timezone differs or it has not synced, and shows when the next reboot is due.
- A reboot is skipped while the router has been up for less than 15 minutes, so a clock jump after boot cannot turn into a reboot loop.