check_vmbr1: offer to auto-create the internal bridge
This commit is contained in:
parent
e1ecfba8ac
commit
a9305ba249
1 changed files with 34 additions and 8 deletions
|
|
@ -61,12 +61,19 @@ STORAGE=$(detect_storage)
|
||||||
|
|
||||||
# ── Check vmbr1 internal bridge ───────────────────────────────────────────────
|
# ── Check vmbr1 internal bridge ───────────────────────────────────────────────
|
||||||
check_vmbr1() {
|
check_vmbr1() {
|
||||||
if ! ip link show vmbr1 &>/dev/null; then
|
ip link show vmbr1 &>/dev/null && return # already present
|
||||||
whiptail --title "vmbr1 Missing" --msgbox \
|
|
||||||
"The internal container bridge vmbr1 does not exist yet.
|
|
||||||
|
|
||||||
Add the following to /etc/network/interfaces on this host,
|
if whiptail --title "Create internal bridge vmbr1?" --yesno \
|
||||||
then run: ifreload -a
|
"The internal container bridge vmbr1 (10.10.10.1/24) doesn't exist yet.
|
||||||
|
|
||||||
|
Create it now? This adds an ISOLATED bridge with no physical ports,
|
||||||
|
so it cannot affect your LAN or vmbr0. It appends a stanza to
|
||||||
|
/etc/network/interfaces and applies it with ifreload -a." 14 68; then
|
||||||
|
|
||||||
|
if grep -qE '^\s*iface\s+vmbr1' /etc/network/interfaces 2>/dev/null; then
|
||||||
|
msg_warn "vmbr1 already defined in /etc/network/interfaces — applying it"
|
||||||
|
else
|
||||||
|
cat >> /etc/network/interfaces <<'EOF'
|
||||||
|
|
||||||
auto vmbr1
|
auto vmbr1
|
||||||
iface vmbr1 inet static
|
iface vmbr1 inet static
|
||||||
|
|
@ -74,8 +81,27 @@ then run: ifreload -a
|
||||||
bridge-ports none
|
bridge-ports none
|
||||||
bridge-stp off
|
bridge-stp off
|
||||||
bridge-fd 0
|
bridge-fd 0
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
msg_info "Bringing up vmbr1"
|
||||||
|
ifreload -a &>/dev/null || systemctl restart networking &>/dev/null || true
|
||||||
|
sleep 2
|
||||||
|
if ip link show vmbr1 &>/dev/null; then
|
||||||
|
msg_ok "vmbr1 up (10.10.10.1/24)"
|
||||||
|
else
|
||||||
|
msg_error "vmbr1 still not up — check /etc/network/interfaces and re-run"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
whiptail --title "vmbr1 Missing" --msgbox \
|
||||||
|
"Cancelled. Add this to /etc/network/interfaces, run 'ifreload -a',
|
||||||
|
then re-run the installer:
|
||||||
|
|
||||||
Then re-run this installer." 18 62
|
auto vmbr1
|
||||||
|
iface vmbr1 inet static
|
||||||
|
address 10.10.10.1/24
|
||||||
|
bridge-ports none
|
||||||
|
bridge-stp off
|
||||||
|
bridge-fd 0" 16 66
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue