Initial commit: Rina VM deployment (VLAN 40, br1.40, cloud-init)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
58
setup-vlan40-bridge.sh
Normal file
58
setup-vlan40-bridge.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run on the hypervisor (satbox) to create bridge br1.40 and attach your VLAN 40 interface.
|
||||
# Create the VLAN interface manually first, e.g.:
|
||||
# ip link add link eth1 name eth1.40 type vlan id 40
|
||||
#
|
||||
# Usage:
|
||||
# sudo ./setup-vlan40-bridge.sh eth1.40
|
||||
# sudo VLAN_IF=eth1.40 ./setup-vlan40-bridge.sh
|
||||
#
|
||||
# Make persistent via systemd-networkd (see docs/vlan40-bridge-systemd-networkd.md).
|
||||
|
||||
set -e
|
||||
|
||||
VLAN_IF="${1:-$VLAN_IF}"
|
||||
BRIDGE="br1.40"
|
||||
|
||||
if [[ -z "$VLAN_IF" ]]; then
|
||||
echo "Usage: $0 <vlan_interface> (e.g. eth1.40)"
|
||||
echo " or: VLAN_IF=eth1.40 $0"
|
||||
echo "Create the VLAN interface manually first: ip link add link eth1 name eth1.40 type vlan id 40"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ip link show "$VLAN_IF" &>/dev/null; then
|
||||
echo "Interface $VLAN_IF not found. Create it first, e.g.:"
|
||||
echo " ip link add link eth1 name eth1.40 type vlan id 40"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Creating bridge $BRIDGE and attaching $VLAN_IF ==="
|
||||
|
||||
# 1) Create bridge if it doesn't exist
|
||||
if ! ip link show "$BRIDGE" &>/dev/null; then
|
||||
echo "Creating bridge $BRIDGE..."
|
||||
ip link add name "$BRIDGE" type bridge
|
||||
ip link set "$BRIDGE" up
|
||||
else
|
||||
echo "Bridge $BRIDGE already exists."
|
||||
ip link set "$BRIDGE" up 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# 2) Attach VLAN interface to bridge
|
||||
if ! ip link show "$VLAN_IF" | grep -q "master $BRIDGE"; then
|
||||
ip link set "$VLAN_IF" master "$BRIDGE"
|
||||
ip link set "$VLAN_IF" up
|
||||
else
|
||||
ip link set "$VLAN_IF" up 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Done. $VLAN_IF is on bridge $BRIDGE."
|
||||
echo "Optionally assign an IP to $BRIDGE if this host must be on VLAN 40, e.g.:"
|
||||
echo " ip addr add 192.168.40.254/24 dev $BRIDGE"
|
||||
echo ""
|
||||
echo "Deploy Rina VM on this bridge with:"
|
||||
echo " BRIDGE=$BRIDGE ./deploy-rina-vm.sh"
|
||||
echo "(Or use systemd-networkd for persistent config; see docs/vlan40-bridge-systemd-networkd.md)"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user