Files
proxmox/scripts/unifi/change-ip-to-vlan11.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

140 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Change dev machine IP to 192.168.11.4 for access to ml110
# Usage: sudo ./scripts/unifi/change-ip-to-vlan11.sh
set -e
INTERFACE="eth0"
NEW_IP="192.168.11.4"
NEW_GATEWAY="192.168.11.1"
NEW_NETMASK="255.255.255.0"
NEW_DNS="192.168.11.1"
echo "🔧 Changing IP address to $NEW_IP for interface $INTERFACE"
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "❌ Please run as root (use sudo)"
exit 1
fi
# Detect network manager
if command -v nmcli >/dev/null 2>&1; then
echo "✅ Using NetworkManager (nmcli)"
# Get active connection name
CONN_NAME=$(nmcli -t -f NAME connection show --active | grep -i "$INTERFACE" | head -1)
if [ -z "$CONN_NAME" ]; then
CONN_NAME=$(nmcli -t -f NAME,DEVICE connection show | grep "$INTERFACE" | cut -d: -f1 | head -1)
fi
if [ -z "$CONN_NAME" ]; then
echo "❌ Could not find connection for $INTERFACE"
echo "Available connections:"
nmcli connection show
exit 1
fi
echo "📋 Found connection: $CONN_NAME"
echo ""
echo "🔄 Changing IP configuration..."
# Change IP settings
nmcli connection modify "$CONN_NAME" ipv4.addresses "$NEW_IP/24"
nmcli connection modify "$CONN_NAME" ipv4.gateway "$NEW_GATEWAY"
nmcli connection modify "$CONN_NAME" ipv4.dns "$NEW_DNS 8.8.8.8"
nmcli connection modify "$CONN_NAME" ipv4.method manual
echo "✅ Configuration updated"
echo "🔄 Restarting connection..."
nmcli connection down "$CONN_NAME"
sleep 2
nmcli connection up "$CONN_NAME"
echo "✅ Connection restarted"
elif [ -d /etc/netplan ]; then
echo "✅ Using netplan"
# Find netplan config file
NETPLAN_FILE=$(ls /etc/netplan/*.yaml 2>/dev/null | head -1)
if [ -z "$NETPLAN_FILE" ]; then
echo "❌ No netplan config file found"
exit 1
fi
echo "📋 Found netplan config: $NETPLAN_FILE"
echo ""
echo "⚠️ Manual edit required for netplan"
echo "Please edit $NETPLAN_FILE and change:"
echo " addresses: [$NEW_IP/24]"
echo " gateway4: $NEW_GATEWAY"
echo " nameservers:"
echo " addresses: [$NEW_DNS, 8.8.8.8]"
echo ""
echo "Then run: sudo netplan apply"
exit 0
elif [ -f /etc/network/interfaces ]; then
echo "✅ Using /etc/network/interfaces"
echo "⚠️ Manual edit required"
echo "Please edit /etc/network/interfaces and change:"
echo " address $NEW_IP"
echo " netmask $NEW_NETMASK"
echo " gateway $NEW_GATEWAY"
echo ""
echo "Then run: sudo systemctl restart networking"
exit 0
else
echo "❌ Could not detect network manager"
echo "Please configure manually:"
echo " IP: $NEW_IP/24"
echo " Gateway: $NEW_GATEWAY"
echo " DNS: $NEW_DNS"
exit 1
fi
# Wait a moment for network to stabilize
sleep 3
# Verify new IP
echo ""
echo "🔍 Verifying new IP configuration..."
NEW_IP_CHECK=$(ip addr show $INTERFACE | grep -oP 'inet \K[\d.]+' | head -1)
if [ "$NEW_IP_CHECK" = "$NEW_IP" ]; then
echo "✅ IP address successfully changed to $NEW_IP"
else
echo "⚠️ IP address check: $NEW_IP_CHECK (expected $NEW_IP)"
fi
# Test gateway
echo ""
echo "🧪 Testing gateway connectivity..."
if ping -c 1 -W 2 $NEW_GATEWAY >/dev/null 2>&1; then
echo "✅ Gateway $NEW_GATEWAY is reachable"
else
echo "⚠️ Gateway $NEW_GATEWAY is not reachable"
fi
# Test ml110
echo ""
echo "🧪 Testing ml110 connectivity..."
if ping -c 1 -W 2 192.168.11.10 >/dev/null 2>&1; then
echo "✅ ml110 (192.168.11.10) is reachable!"
else
echo "⚠️ ml110 (192.168.11.10) is not reachable (may need firewall config)"
fi
echo ""
echo "✅ IP change complete!"
echo ""
echo "📋 Current configuration:"
ip addr show $INTERFACE | grep "inet "
ip route show | grep default