This is a simple dashboard for OpenWrt that does the following things:
- Displays router uptime.
- Keeps track of all PPPoE disconnects.
- Displays PPPoE IP and uptime.
- Monitors all devices that connect to the router.
- Shows real-time total bandwidth usage.
- Shows real-time per-user bandwidth usage.
Note: Most stuff only works with IPv4
The installation process have two main parts:
- Install the WebUI.
- Configure your OpenWrt router.
Setting up the WebUI is pretty simple if you are familiar with Docker and docker-compose. Just create a docker-compose.yml
file as shown below, configure the environment variables, and run the container.
---
version: '2.1'
services:
openwrtstats:
image: lov432/openwrt-stats:latest
container_name: openwrtstats
volumes:
- ./db/:/app/db/
ports:
- 3000:3000
environment:
- PASSWORD= # Password provided by router_setup.sh. Leave it empty if you haven't set up the router yet.
- ROUTER_URL=http://192.168.1.1 # URL of your router
- MAX_UPLOAD_SPEED=20 # Maximum upload speed in Mbps
- MAX_DOWNLOAD_SPEED=20 # Maximum download speed in Mbps
restart: unless-stopped
After running this container, the WebUI will be accessible at http://localhost:3000
.
Before proceeding, you should probably very definitely take a backup of your router.
Before running the script, make sure you have the following dependencies installed on your OpenWrt router:
-
curl: You can install curl with the following commands:
opkg update opkg install curl
-
iptables-zz-legacy: To install iptables-zz-legacy:
opkg update opkg install iptables-zz-legacy
-
wrtbwmon: You can install the wrtbwmon package by uploading the .ipk file via OpenWrt's LuCI interface. Navigate to "System > Software" and use the "Upload Package" feature to install it. You can find the package at https://github.com/pyrovski/wrtbwmon.
Before proceeding, you need to enable the wrtbwmon
service. Run the following commands to start and enable it:
/etc/init.d/wrtbwmon start
/etc/init.d/wrtbwmon enable
- Download the setup script to your router using curl:
curl -LO https://raw.githubusercontent.com/LoV432/next-openwrt-stats/master/router_setup.sh
- Make the script executable by running the following command:
chmod +x router_setup.sh
To run the setup script, you need to provide your WebUI URL and the PPPoE interface name. Ensure that there are no trailing slashes in the URL. You can find the PPPoE interface name under "Network > Interfaces" on OpenWrt LuCi
./router_setup.sh https://webui.example.com wan
The script will generate a password, which you'll need to add to your docker-compose.yml
file. After adding the password, recreate the container.
In some cases, you might need to disable DNS rebind protection. You can do this from the "Network > DHCP and DNS" settings in your OpenWrt router's web interface.