chv-cell: networkd 不管 ve + 单元内 DNS 修复

- systemd-networkd(/usr/lib 80-container-ve.network,匹配 ve-*)
  会在 veth 建好后几秒内刷掉静态 10.200.0.1、改 DHCP/链路本地,
  致单元网关不可达、TCP/UDP 全灭(FORWARD/NAT 计数器恒 0;
  早先一次 curl 403 是刷掉前的窗口期偶发)。修法:镜像内置
  /etc/systemd/network/79-chv-cell.network(Unmanaged=yes),
  须排在 80 之前(99 会被 80 抢走,已实测);build.sh copy-in
  + 校验、BASE_CONTENTS 与两处 DECLARED_SOURCES 登记。
- run_cell 配网后复核 ve 上确有 10.200.0.1(_iface_has_ip),
  不见即大声失败、不跑无网单元(第二道防线)。
- 单元内 DNS:/etc/resolv.conf 是 127.0.0.53 stub,单元独立
  netns 里自己的 lo 上没有 resolver;把上游
  /run/systemd/resolve/resolv.conf 绑到 /etc/resolv.conf
  (解析 symlink 后挂真实目标)。live 验证:DNS-UDP-OK、
  getaddrinfo 解析成功、curl https://gitea.tose.top 200。
- 单测:CellResolvTest + _iface_has_ip 真实 lo 断言 + 规约
  dns_resolv_conf 字段;P2 + 阶段 2 共 74 项全过。
This commit is contained in:
host committed 2026-11-08 09:45:00 +00:00
1 parent 4b5f2f124f
commit 1cbaf7c1d5
7 files changed
+48

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# NOTE: must sort before /usr/lib/systemd/network/80-container-ve.network (systemd built-in container-veth config, matches ve-*), otherwise that file wins and networkd DHCPs the interface.
# chv-cell veth: managed entirely by chv-cell (static 10.200.0.1/24 + NAT).
# systemd-networkd must not touch it: it would DHCP/link-local the
# interface and flush the static address, breaking all cell networking
# (2026-11-07 live diagnosis: 10.200.0.1 vanished within seconds of
# the veth being created, cell gateway unreachable, FORWARD/NAT
# counters stayed 0 for both TCP and UDP).
[Match]
Name=ve-chv-cell
[Link]
Unmanaged=yes