RouterOS per-device traffic & app (DPI) stats via IPFIX + DNS. RouterOS 终端流量与应用统计
10K+
RouterOS 终端流量、应用统计与上网审计面板。按 今日 / 昨日 / 本周 / 本月 统计每台终端、每个人的流量和应用使用情况(类似 Panabit / 维盟),记录访问日志并按规则告警(参照深信服 AC);分家庭和企业两种场景。
Per-device and per-person traffic, per-application (DPI-style) statistics and access auditing for MikroTik RouterOS, built on IPFIX + DNS / SNI sniffing.
Source & docs: https://github.com/suyijun8182/ros-dpi
Linux 一键安装(无需 Docker,SQLite 零配置起步,网页一键升级):
curl -fsSL https://raw.githubusercontent.com/suyijun8182/ros-dpi/main/install.sh | sudo bash
Docker Compose(自带 MySQL 的模板见仓库):
services:
ros-dpi:
image: suyijun8182/ros-dpi:latest
restart: unless-stopped
ports:
- "8080:8080/tcp"
- "2055:2055/udp"
- "37008:37008/udp"
environment:
TZ: Asia/Shanghai
LAN_CIDRS: 192.168.88.0/24
volumes:
- ./data:/app/data
前提:已有 MySQL 5.7+(建库语句见仓库 README);还没有 MySQL 用仓库里的 docker-compose.with-mysql.yml。镜像同时发布在 GHCR,支持 amd64 / arm64,每次发版带版本标签。
[job] 日志只记录耗时或内存变化较大的任务。Startup loads each library once, heavy jobs run one at a time, compact ASN index, quieter job logs.MEMORY_BUDGET_MB 与 compose mem_limit 示例;系统设置外部数据源改为卡片分组,并提高说明文字对比度。Fixes memory growth over time (memory-sized caches, skip unchanged rule reloads, chunked community library, periodic reclaim, MEMORY_BUDGET_MB); settings page cleanup and better text contrast.http://198.55.109.62:8080,使用内置地址的实例升级后自动切换,自定义地址继续优先;降低长时间运行的内存保留与后台任务峰值。Default community hub moved to http://198.55.109.62:8080 (custom hub URLs still take precedence); lower long-running memory retention and background-task peaks.scripts/ndpi_eval.py 用 nDPI 离线对照)。Accuracy check (known-answer probes per device and app) and packet sampling (beta: pcap plus per-connection labels for offline comparison with nDPI). 同时修复 Linux 单文件二进制缺识别规则文件、启动即崩的问题 / Fixed the Linux single-file binary crashing at startup because rule yaml files were not bundled./api/ha/summary(流量、在线、识别率、健康指数、应用构成、终端及其主要应用)。Read-only API tokens and a /api/ha/summary endpoint for Home Assistant.ros-dpi 运行(不再是 root),systemd 加固;审计规则的按天累计和“已提醒”在重启后接着算,不再重复提醒;系统设置 → 外部数据源 打开时就加载社区共享库状态;CI 的 action 全部钉到 commit SHA。Linux service now runs as a dedicated non-root user; audit rule progress survives restarts; CI actions pinned to commit SHAs.https://rosdpi.vviip.dpdns.org:8443),Docker 实例不用再开 IPv6。Built-in community hub moved to an IPv4-reachable VPS.COLLECTOR_ALLOWED、管控脚本防注入、一键更新校验 SHA256、arm64 二进制等);社区主站地址可在网页填写,新增 VPS 主站部署模板(deploy/hub/,Docker + Caddy 自动 HTTPS);接入向导与文档补上 IPv6 嗅探(/ipv6 firewall mangle 4 条)和 FastTrack(IPv4 / IPv6)命令;自检检查 IPv6 的 FastTrack。Setup guide and docs now include IPv6 sniff rules and FastTrack commands for both families; the self-check also flags IPv6 FastTrack without a connection-bytes limit.install.sh 一键安装 systemd 服务(SQLite 零配置起步);修复落库卡死(代理长域名撑爆 access_log.remote 列导致每分钟落库失败、在线终端归零);组播 / 广播流量不再计入统计;17 个 DPI 大类配色互异。{"data": [...]}) is now read (0.6.5 always got 0 answers); new upstream rule directories / lists are registered automatically; history reclassification looks up the DNS cache for IP-only rows and runs automatically after library updates.Linux one-line install / 一键安装(无需 Docker)
curl -fsSL https://raw.githubusercontent.com/suyijun8182/ros-dpi/main/install.sh | sudo bash
SQLite out of the box; upgrades are one click in the UI. 想用 MySQL:设 DATABASE_URL 后重启服务。
Docker Compose(已有 MySQL / with your MySQL)
前提:已有 MySQL 5.7+(建库语句见仓库 README)。Set LAN_CIDRS, then docker compose up -d.
services:
ros-dpi:
image: suyijun8182/ros-dpi:latest
restart: unless-stopped
ports:
- "8080:8080/tcp"
- "2055:2055/udp"
- "37008:37008/udp"
environment:
TZ: Asia/Shanghai
LAN_CIDRS: 192.168.88.0/24
volumes:
- ./data:/app/data
No MySQL yet? / 还没有 MySQL? Use docker-compose.with-mysql.yml from the repo. 这个文件会同时启动 MySQL 并且已配置好连接,不需要建库,也不需要在网页上填写。
Open http://<host>:8080. The setup wizard has two steps. 打开网页后按两步完成:
./data/db_config.json and restart. 更换数据库:删除该文件后重启容器。ROS_URL / ROS_USER / ROS_PASSWORD。网页填写的值优先。 We recommend entering the router address and read-only credentials under Settings → RouterOS API. Environment variables supply the defaults.| Port | Use |
|---|---|
| 8080/tcp | Web UI |
| 2055/udp | IPFIX / NetFlow v9 |
| 37008/udp | TZSP (DNS answers + TLS/QUIC handshakes) |
| Variable | Default | Description |
|---|---|---|
DATABASE_URL | set in compose | mysql+pymysql://user:pass@host:3306/rosdpi?charset=utf8mb4;二进制部署留空则用 SQLite |
LAN_CIDRS | private ranges | LAN ranges, comma separated |
ADMIN_PASSWORD | empty | initial password for admin |
ROS_URL / ROS_USER / ROS_PASSWORD | empty | Default RouterOS REST address and read-only credentials. Web settings take precedence. |
SINGBOX_URL / MOSDNS_URL / LOCALDNS_URL / ADGUARD_URL | empty | external sources (Clash API, MosDNS audit, LocalDNS query log, AdGuard Home query log) |
SHARE_HUB_URL | http://198.55.109.62:8080 | community hub (built in); point it at your own hub for a private community |
SHARE_HUB | false | run this instance as the community hub (only the hub sets true) |
SHARE_VERIFY_TLS | true | verify the hub certificate; set false only for a private hub with a self-signed cert |
COLLECTOR_ALLOWED | empty | accept IPFIX / TZSP only from these IPs / CIDRs (usually the router); empty = any |
SHARE_TRUSTED_PROXIES | empty | hub only: trusted reverse proxies whose X-Forwarded-For is honoured; empty = private / loopback |
TZ | Asia/Shanghai | statistics time zone (weeks start Monday) |
Full list: https://github.com/suyijun8182/ros-dpi#环境变量
docker pull suyijun8182/ros-dpi:latest