Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/modules/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ net 负责路由器的"线":物理网口和网桥、LAN 与额外网络(访
| VLAN 网络 | 额外网络可带 802.1Q 标签:`<port>.<vlan>` 加入该网络的网桥,端口原来的用途不变 | 无 |
| 接口状态 | `net.ports` 读 `/sys/class/net`:链路、速率、双工、计数、错误;网页显示前面板网口 + 接口表(实时速率) | 无 |
| WAN DNS | 钩子维护 `/run/mini-router/resolv.conf`(在线线路的 DNS,健康的优先),dnsmasq 读它 | 无 |
| PPPoE 公网地址保护 | `wan[].require_public_ip: true` 在 PPPoE 拿到 RFC1918、100.64.0.0/10 或 169.254.0.0/16 地址时只重拨这一条线路;默认间隔 180 秒,可用 `require_public_ip_gap` 调整。已有 crond 每分钟复查,冷却后继续重拨;连续 5 次私网地址后停止自动重拨并记录 risk 事件,状态在 `/run/mini-router/`,重启清零 | 无(复用 PPPoE 服务) |

删除 WAN 或切换协议时,`mr apply` 只清理文件首行是 `# generated by mr` 的旧 peer;用户自行维护的
`/etc/ppp/peers/*` 会保留。生成的 peer 会进入 apply 快照,以便失败回滚恢复;快照可能包含 PPPoE
Expand Down Expand Up @@ -52,6 +53,9 @@ ip rule
4. 负载均衡(`mode: balance`):只处理 `meta mark 0x0` 的新 IPv4 连接,目标不是 LAN 侧网络。
- 健康检测判定某线路故障时:该线路 main 表默认路由 metric +10000(下一条接管,但检测 ping 仍能从它出去),
它的 WAN 表删掉默认路由(策略路由 / 均衡 / 恢复标记的流量落到 main = 最好的健康线路),并从均衡表里拿掉。恢复后全部还原。
IPv6 的 RA 默认路由和源前缀默认路由同步升高同样的 metric,避免 IPv4 已切换而 IPv6 仍从故障线路出站;这项 IPv6 健康联动只在 `multiwan.mode: failover|balance` 开启时生效,未开多 WAN 健康检测的旧配置不会改写 RA 路由。

`require_public_ip` 的复查由生成的 `* * * * * /usr/sbin/mr wan public-check --cron` 执行,不增加常驻进程。私网会话(包括冷却中和已停止重拨的状态)不会触发 `multiwan.dial_order` / `dial_restore`;最终拿到公网地址的会话按 `dial_restore` 的正常规则处理。
- 状态文件(tmpfs):`/run/mini-router/wan/<wan>.json`(这条线拿到的地址、网关、DNS、上线时间),
`/run/mini-router/wan-state.json`(健康检测每轮写),`/run/mini-router/resolv.conf`。

Expand Down Expand Up @@ -151,6 +155,8 @@ wan:
ipv6: true # dhcpcd:RA / DHCPv6
ipv6_pd: true # 申请前缀放到 LAN
ipv6_srcroute: false # 源地址是本线路前缀的 IPv6 从本线路走(多线必开)
require_public_ip: true # PPPoE 被 ISP 放入私网/CGNAT 时自动重拨这一条线
require_public_ip_gap: 180 # 自动重拨冷却秒数(默认 180)
- name: hotel # 出差:插到别人的网络上
device: wan
proto: dhcp
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/sys.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Validation (the security boundary — everything below ends up in a file, a cron
| `/etc/conf.d/tailscale` (on) | `TS_PORT=` (read by `/etc/init.d/tailscale`) | restart `tailscale` |
| `/etc/conf.d/mr-panel` (on) | `PANEL_ADDR=` main LAN address (was a `sed` on router.yaml) | restart `mr-panel` |
| `/etc/conf.d/crond` (schedules) | `CRON_OPTS`, `export TZ=…` | restart `crond` |
| `/etc/crontabs/root` | managed block between markers (schedules; DDNS on with an interval adds `*/N * * * * /usr/sbin/mr ddns sync --cron`; the reverse proxy adds `M H * * * /usr/sbin/mr edge renew --cron`, M and H fixed per router, H 2–5; dns.adblock adds `M * * * * /usr/sbin/mr dns adblock update --cron`; wifi.steering / wifi.self_heal add `* * * * * /usr/sbin/mr wifi tick`); Alpine's periodic lines and anything else kept | — (crond rescans the directory) |
| `/etc/crontabs/root` | managed block between markers (schedules; DDNS on with an interval adds `*/N * * * * /usr/sbin/mr ddns sync --cron`; the reverse proxy adds `M H * * * /usr/sbin/mr edge renew --cron`, M and H fixed per router, H 2–5; dns.adblock adds `M * * * * /usr/sbin/mr dns adblock update --cron`; `wan[].require_public_ip` adds `* * * * * /usr/sbin/mr wan public-check --cron`; wifi.steering / wifi.self_heal add `* * * * * /usr/sbin/mr wifi tick`); Alpine's periodic lines and anything else kept | — (crond rescans the directory) |
| `/etc/mini-router/gen/edge.json` (edge on) | port, WAN port, certificate directory, routes (host, target, certificate name, allow) — nothing secret, 0644 | restart `mr-edge` |
| `/root/.ssh/authorized_keys` | managed block between markers; every other line kept | — (read per login) |

Expand Down
2 changes: 2 additions & 0 deletions examples/lab.d/10-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ wan:
peerdns: true
ipv6: true
ipv6_pd: true
require_public_ip: true
require_public_ip_gap: 180
modem: {address: 192.168.1.1} # optional bridged modem management path
- name: wan2 # backup; also carries desktop (policy below)
device: wan
Expand Down
Loading
Loading