Files
proxmox/scripts/unifi/add-vlan11-secondary-ip.sh.bak
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

99 lines
2.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
# Add VLAN 11 secondary IP address to current machine
# This allows the machine to have both its current IP and an IP on VLAN 11
set -e
# Configuration
VLAN11_IP="192.168.11.23"
VLAN11_NETMASK="24"
VLAN11_GATEWAY="192.168.11.1"
# Detect primary interface
PRIMARY_IF=$(ip route show | grep default | awk '{print $5}' | head -1)
if [ -z "$PRIMARY_IF" ]; then
echo "❌ Could not detect primary network interface"
exit 1
fi
CURRENT_IP=$(ip -4 addr show $PRIMARY_IF 2>/dev/null | grep -oP 'inet \K[\d.]+' | head -1)
CURRENT_GW=$(ip route show | grep default | awk '{print $3}' | head -1)
echo "🔧 Adding VLAN 11 Secondary IP Address"
echo ""
echo "📋 Configuration:"
echo " Primary Interface: $PRIMARY_IF"
echo " Current IP: $CURRENT_IP"
echo " Current Gateway: $CURRENT_GW"
echo " VLAN 11 IP: $VLAN11_IP/$VLAN11_NETMASK"
echo " VLAN 11 Gateway: $VLAN11_GATEWAY"
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "❌ This script must be run with sudo"
echo " Usage: sudo $0"
exit 1
fi
# Check if VLAN 11 IP already exists
if ip addr show $PRIMARY_IF | grep -q "$VLAN11_IP"; then
echo "✅ VLAN 11 IP ($VLAN11_IP) already configured on $PRIMARY_IF"
exit 0
fi
# Add secondary IP address
echo " Adding secondary IP address $VLAN11_IP/$VLAN11_NETMASK to $PRIMARY_IF..."
ip addr add $VLAN11_IP/$VLAN11_NETMASK dev $PRIMARY_IF
if [ $? -eq 0 ]; then
echo " ✅ Secondary IP added successfully"
else
echo " ❌ Failed to add secondary IP"
exit 1
fi
# Add route to VLAN 11 network (if not already present)
if ! ip route show | grep -q "192.168.11.0/24"; then
echo " Adding route to VLAN 11 network..."
ip route add 192.168.11.0/24 dev $PRIMARY_IF src $VLAN11_IP
echo " ✅ Route added"
else
echo " ✅ Route to VLAN 11 already exists"
fi
# Test connectivity
echo ""
echo "🧪 Testing Connectivity..."
sleep 2
# Test VLAN 11 gateway
if ping -c 1 -W 2 $VLAN11_GATEWAY >/dev/null 2>&1; then
echo " ✅ VLAN 11 gateway ($VLAN11_GATEWAY) is reachable"
else
echo " ⚠️ VLAN 11 gateway ($VLAN11_GATEWAY) is not reachable"
echo " (This may be normal if gateway is not configured)"
fi
# Test Proxmox hosts
for host in "192.168.11.10:ml110" "192.168.11.11:r630-01" "192.168.11.12:r630-02"; do
IFS=':' read -r ip name <<< "$host"
if ping -c 1 -W 2 $ip >/dev/null 2>&1; then
echo "$name ($ip) is reachable"
else
echo " ⚠️ $name ($ip) is not reachable"
fi
done
echo ""
echo "✅ Configuration Complete!"
echo ""
echo "📋 Current IP Addresses:"
ip addr show $PRIMARY_IF | grep "inet " | sed 's/^/ /'
echo ""
echo "💡 Note: This configuration is temporary and will be lost on reboot."
echo " To make it persistent, configure netplan or network manager."
echo ""