Skip to content

Mini-Router v0.4.0

Choose a tag to compare

@Cd1s Cd1s released this 18 Oct 06:01
· 14 commits to main since this release
0f37e7f

Mini-Router

新内容 / What's new

首次设置向导 / First-run setup wizard (#139, #157)

  • 新装好的路由器第一次登录后进入向导:管理员密码、时区、WAN 探测、上游与 LAN 网段冲突检查、WiFi,最后在确认窗口里应用(不保留就自动回滚)。
  • mr wan detect:用独立的 PPPoE discovery 和一次性 DHCP DISCOVER 探测上游(只等 OFFER,不写租约、不装路由),报告 AC / 服务名、地址 / 网关 / DNS、链路速率。
  • A wizard after the first login on a new router: password, time zone, WAN detection, upstream/LAN conflict check, WiFi, applied inside a confirm window. mr wan detect probes PPPoE and DHCP without taking a lease or installing routes.

换环境 / 搬家更稳 / Moving house, changing ISPs (#138, #141, #134, #158)

  • 光猫和路由器 LAN 同网段(例如光猫 192.168.1.254、LAN 192.168.1.0/24):网关落在 LAN 网段时装 <网关>/32 dev wan,只对网关做 proxy ARP 并 masquerade,上网、DNS、光猫管理页都能用;mr doctor 提示网段冲突和改法。wan[].modem 让 PPPoE 线路也能访问光猫管理地址。
  • 换 WAN 协议(PPPoE ↔ DHCP ↔ 静态)后清理旧状态:迟到的 ip-down 被忽略,旧 IPv6 前缀在确认后退役,只删 mr 自己建的 VLAN,取消 wan[].mac 后恢复网卡原厂 MAC。
  • 回滚会停掉被删除 WAN 的服务;首次启动遇到被拒的配置能恢复;多 WAN 的 apply / 恢复备份回滚更稳(改过的 PPPoE 仍会回滚,没改的备用线路不受影响,一个有上限的校验时限,恢复中的列表快照断电后仍在)。
  • Upstream on the LAN's own subnet keeps internet, DNS and the modem page working (gateway /32 route, gateway-only proxy ARP, masquerade); WAN protocol switches leave no stale state; rollback and multi-WAN restore are hardened.

运营商 DNS 与 IPv6 / ISP DNS and IPv6 (#138, #150, #158)

  • dnsmasq 的上游 DNS 合并 PPPoE peerdns、DHCP option 6、DHCPv6,按健康状态排序;dns.fallback 在都不可用时兜底。
  • DHCPv6 回复按 WAN 接口放行(链路本地目的地址、源端口 547),不再因运营商用了不规范的源地址被丢。
  • IPv6 默认路由跟随多线路健康状态;同一 WAN 的委派前缀按网络分给多个 LAN 网络(每个网络固定的 SLA ID)。
  • Upstream DNS from every ISP source, health-ordered, with dns.fallback; DHCPv6 replies accepted by WAN interface (odd source addresses); IPv6 default routes follow multi-WAN health; a delegated prefix is split across LAN networks.

PPPoE 公网地址保护 / Public IPv4 guard (#150, #157)

  • wan[].require_public_ip: true:PPPoE 拿到私网 / CGNAT(RFC1918、100.64.0.0/10、169.254.0.0/16)地址时只重拨这一条线,冷却 require_public_ip_gap(默认 180 秒),连续 5 次后停止并记一条 risk 事件,mr doctor 也显示为 risk。复查由 crond 每分钟一次,不加常驻进程。
  • mr doctor 能认出"线路换成了 DHCP"(节流的 DHCP 探测),不再只说"没有 IPv4 地址"。
  • Redial a PPPoE line that got a private/CGNAT address, with a cooldown and a stop after 5 tries (risk event, shown by doctor); doctor names a line that switched to DHCP.

改 LAN 网段不失联 / Changing the LAN subnet (#153)

  • 在网页上改 lan.ipv4 时,配置里落在旧网段的地址(DHCP 固定分配、端口转发目标等)一起平移到新网段,旧网桥地址被清掉,有线 LAN 口短暂 down/up 让电脑续租;网页拿到一次性令牌,在新地址上确认(120 秒内只接受 LAN 来源一次)。
  • Renumbering the LAN in the web UI shifts the config's addresses in the old subnet, removes old bridge addresses, lets wired clients renew and confirms on the new address with a one-time token.

网页补齐 / Web UI (#132, #136, #154)

  • 系统、防火墙、代理:watchcat、Tailscale 出口节点 / 子网路由 / 登录、HTTPS 反向代理、LED、guard、按设备在家 / 离家生效的规则、按设备走代理。
  • WiFi 按硬件建议生成(wifi.defaults)、DNS 列表文件编辑、按设备的 DHCP 租约。
  • WAN 与多线路:拨号顺序与重拨、删除时清理引用、IPv6 开关、多拨 MAC、光猫访问、公网 IPv4 保护、策略路由域名列表。
  • System / firewall / proxy controls, WiFi defaults, DNS list editor, per-device leases, and the remaining WAN and multi-WAN settings.

Alpine 安装 / install.sh (#143, #147, #148)

  • 修复:没有 WiFi 的机器(虚拟机、多数 x86 小主机)上 install.sh 第 5 步总是回滚(不再重启配置没启用的 mr-hostapd)。
  • 修复:全新机器上第一次应用时 /run/mini-router 还不存在导致回滚。
  • 选 PPPoE 时先检查内核能否加载 pppoe(Alpine 的 linux-virt 内核没有),不能就立刻给出办法(apk add linux-lts 后重启),不再等 90 秒后回滚;mr-pppoe 和 mr doctor 也写明原因。
  • Fixes: install.sh no longer rolls back on WiFi-less machines or on the first apply of a fresh machine; PPPoE checks the kernel first (Alpine's linux-virt has no PPPoE) and says what to do.

全新环境实验室 / Fresh-environment lab (#149, #155)

  • tools/lab/:在全新 Alpine 虚拟机里跑真实的 install.sh,模拟运营商(DHCP、PPPoE、DHCPv6-PD、CGNAT、光猫同网段)和局域网电脑,场景 01–07 输出 TAP。实验室 ID 主机级加锁,多个目录 / agent 同时用不会互相拆台。只在构建机上运行,不进 GitHub Actions。
  • tools/lab/: real install.sh on fresh Alpine VMs with simulated ISPs and a LAN client, scenarios 01–07, host-wide lab id locks.

其它 / Other (#128, #130)

  • 不开 IPv6 的 WAN 不再接收 RA;删除 WAN 或它的 IPv6 时一并删除引用它的设置。经 LAN 上网关的静态路由会 masquerade 去往目标的 LAN 流量。

升级说明 / Upgrade notes

  • 不会弹向导:向导标记只在全新 / 擦除后的 rootfs_data(AX6000)或 MR_APPLY=0 的安装里创建;老用户升级不会出现向导。
    Existing installs never see the wizard: its marker is only created on a new or wiped config partition, or by an MR_APPLY=0 install.

  • 面板监听所有地址:/etc/conf.d/mr-panel 变成 PANEL_ADDR=0.0.0.0(改 LAN 网段时新旧地址都能连),防火墙的 input 链只放行 LAN 网桥和 Tailscale、丢弃 WAN 进来的连接;mr-panel 在防火墙之后启动,nftables 表不在时退回只监听 LAN 地址。
    The panel listens on all addresses, protected by mr-firewall, whose input chain accepts only the LAN bridges and Tailscale (it starts after the firewall and falls back to the LAN address without it).

  • 防火墙 / dhcpcd:DHCPv6 客户端的入站规则改为按 WAN 接口放行;多个 LAN 网络时委派前缀也分给其它网络(主 LAN 的前缀不变)。升级后第一次 mr apply 会重载防火墙、重启 mr-panel,network.sh 原地重跑一次;先用 mr plan 看清楚。
    The DHCPv6-client firewall rule now matches by WAN interface; extra LAN networks also receive delegated prefixes (the main LAN's stays). The first apply after the update reloads the firewall and restarts mr-panel; check with mr plan first.

  • Redmi AX6000:

    /usr/libexec/mr/sysupgrade -T --sha256 <SHA256SUMS 里的值> /tmp/mini-router-ax6000-v0.4.0-sysupgrade.tar
    setsid /usr/libexec/mr/sysupgrade -y --sha256 <同上> /tmp/mini-router-ax6000-v0.4.0-sysupgrade.tar > /tmp/su.log 2>&1 &

    约 2 分钟后回来,设置保留;新镜像第一次启动时删掉 overlay 里镜像自带程序的旧副本(手工替换过的 /usr/sbin/mr、/www 文件等),让新版本生效。
    Back in about 2 minutes with settings kept; the first boot drops overlay copies of the image's own programs (e.g. a hand-replaced /usr/sbin/mr).

  • Alpine:apk add ethtool(新依赖),把 mr-linux-<架构> 装成 /usr/sbin/mr、mini-router-rootfs.tar.gz 解到 /(同 install.sh 第 2 步,不要重跑整个 install.sh——它会重新生成 router.yaml),然后 mr plan、mr apply --confirm 120。
    Alpine: apk add ethtool (new dependency), replace /usr/sbin/mr and unpack the rootfs tarball over / (install.sh step 2 — do not re-run the whole installer, it regenerates router.yaml), then mr plan and mr apply --confirm 120.

安装 / Install

  • 任意架构的 Alpine Linux(x86_64 / arm64 / armv7 / armv6 / x86 / riscv64 / ppc64le):
    wget -O install.sh https://github.com/Cd1s/mini-router/releases/download/v0.4.0/install.sh && MR_VERSION=v0.4.0 sh install.sh
    (预发布期间要写 MR_VERSION=v0.4.0,否则 install.sh 下载的是 latest 那一版 / while this is a pre-release, MR_VERSION=v0.4.0 is required)。
    单网口设备、旁路由、MR_APPLY=0:见 docs/install-alpine.md。
  • Redmi AX6000(hanwckf 110M U-Boot 布局):mini-router-ax6000-v0.4.0-sysupgrade.tar(刷机 / 升级)、-initramfs.cpio.xz、-kexec.tar.gz(从 OpenWrt 里先在内存试运行:Image、dtb、devmem、kexec-test.sh、initramfs)。见 docs/flash.md。镜像带 tailscaled 和 dstatus-agent(同 v0.3.2)。

文件 / Assets

SHA256SUMS 列出每个文件的校验值。