feat: provision 写入 NM keep-configuration=no——禁止开机收编 initramfs(dracut 遗留 DHCP)抢配的连接,强制按 autoconnect-priority 选路激活静态档案;initrd 的 DHCP 租约以副地址共存(双 IP:静态主+DHCP 副兜底);rollback 对称移除
This commit is contained in:
1 parent
9035f9eb96
commit
05a476d932
2 files changed
+13
No files matched your search
@@ -9,6 +9,8 @@
|
||||
# 4. 禁用 cloud-init 网络管理,netplan renderer 切换为 NetworkManager
|
||||
# 5. rfkill 解锁无线网卡
|
||||
# 6. 安装 polkit 放行规则(容器内 root 调用 NM/systemd D-Bus)
|
||||
# 7. 禁止 NM 开机收编 initramfs 抢配的连接(keep-configuration=no),
|
||||
# 确保开机按 autoconnect-priority 选路,静态档案不被绕过
|
||||
#
|
||||
# 用法: sudo bash provision-host.sh
|
||||
# 回滚: sudo bash rollback-host.sh
|
||||
@@ -41,6 +43,16 @@ cat > /etc/NetworkManager/conf.d/99-mixingx.conf <<'EOF'
|
||||
no-auto-default=*
|
||||
EOF
|
||||
|
||||
# 禁止 NM 开机收编 initramfs 阶段(dracut 遗留 DHCP 配置)抢配的现状:
|
||||
# 默认 keep-configuration 走 connection-assumed,autoconnect-priority 选路不执行,
|
||||
# 静态档案开机被绕过(表现为"重启后静态 IP 变回 DHCP")。
|
||||
# 设为 no 后 NM 开机总是按最高 autoconnect-priority 激活持久档案;
|
||||
# initrd 抢到的 DHCP 租约会以副地址共存(双 IP:静态主 + DHCP 副兜底)。
|
||||
cat > /etc/NetworkManager/conf.d/98-keep-configuration.conf <<'EOF'
|
||||
[device]
|
||||
keep-configuration=no
|
||||
EOF
|
||||
|
||||
systemctl enable --now NetworkManager >/dev/null 2>&1 || true
|
||||
|
||||
# ── 2. 识别主网口并读取当前参数 ───────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user