Files
proxmox/scripts/archive/consolidated/config/configure-persistent-networks.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

101 lines
3.7 KiB
Bash
Executable File

#!/bin/bash
# Configure persistent network settings for all reassigned containers using systemd-networkd
set -uo pipefail
NODE_IP="${PROXMOX_HOST_R630_01}"
GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}"
# Container IP mappings
declare -A container_ips=(
["10000"]="${ORDER_POSTGRES_PRIMARY:-192.168.11.44}"
["10001"]="${ORDER_POSTGRES_REPLICA:-192.168.11.45}"
["10020"]="${ORDER_REDIS_IP:-192.168.11.38}"
["10030"]="192.168.11.40"
["10040"]="192.168.11.41"
["10050"]="192.168.11.49"
["10060"]="192.168.11.42"
["10070"]="${IP_SERVICE_50:-${IP_SERVICE_50:-${IP_SERVICE_50:-${IP_SERVICE_50:-192.168.11.50}}}}"
["10080"]="192.168.11.43"
["10090"]="${IP_SERVICE_36:-${IP_SERVICE_36:-${IP_SERVICE_36:-${IP_SERVICE_36:-192.168.11.36}}}}"
["10091"]="${IP_SERVICE_35:-${IP_SERVICE_35:-${IP_SERVICE_35:-${IP_SERVICE_35:-192.168.11.35}}}}"
["10092"]="${IP_MIM_WEB:-192.168.11.37}"
["10200"]="192.168.11.46"
["10201"]="192.168.11.47"
["10202"]="192.168.11.48"
["10210"]="192.168.11.39"
["10230"]="${IP_SERVICE_51:-${IP_SERVICE_51:-${IP_SERVICE_51:-${IP_SERVICE_51:-192.168.11.51}}}}"
["10232"]="192.168.11.52"
)
echo "═══════════════════════════════════════════════════════════"
echo "Configuring Persistent Network Settings"
echo "═══════════════════════════════════════════════════════════"
echo ""
SUCCESS=0
FAILED=0
for vmid in "${!container_ips[@]}"; do
ip="${container_ips[$vmid]}"
hostname=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
"pct config $vmid 2>/dev/null | grep '^hostname:' | sed 's/^hostname: //'" || echo "CT$vmid")
echo "Configuring CT $vmid ($hostname) - $ip..."
# Create systemd-networkd configuration
config_content="[Match]
Name=eth0
[Network]
Address=${ip}/24
Gateway=${GATEWAY}
DNS=${NETWORK_GATEWAY:-192.168.11.1}
DNS=8.8.8.8
DNS=1.1.1.1
"
# Write configuration file
if ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
"pct exec $vmid -- sh -c 'mkdir -p /etc/systemd/network && cat > /etc/systemd/network/10-eth0.network << \"EOF\"
[Match]
Name=eth0
[Network]
Address=${ip}/24
Gateway=${GATEWAY}
DNS=${NETWORK_GATEWAY:-192.168.11.1}
DNS=8.8.8.8
DNS=1.1.1.1
EOF
'" 2>&1; then
echo " ✅ Network config file created"
# Enable and start systemd-networkd
if ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
"pct exec $vmid -- systemctl enable systemd-networkd 2>&1 && pct exec $vmid -- systemctl start systemd-networkd 2>&1" 2>&1 | grep -v "Created symlink"; then
echo " ✅ systemd-networkd enabled and started"
((SUCCESS++))
else
echo " ⚠️ Config created but systemd-networkd may not be running"
((SUCCESS++))
fi
else
echo " ❌ Failed to create network config"
((FAILED++))
fi
echo ""
sleep 1
done
echo "═══════════════════════════════════════════════════════════"
echo "Configuration Complete"
echo "═══════════════════════════════════════════════════════════"
echo " Success: $SUCCESS"
echo " Failed: $FAILED"
echo " Total: ${#container_ips[@]}"
echo ""
echo "Note: Network configuration will persist across container restarts"
echo "═══════════════════════════════════════════════════════════"