Skip to content

Instantly share code, notes, and snippets.

@boutzamat
Created April 3, 2025 11:46
Show Gist options
  • Save boutzamat/834aec7c014eb981de3e15e4337eb558 to your computer and use it in GitHub Desktop.
Save boutzamat/834aec7c014eb981de3e15e4337eb558 to your computer and use it in GitHub Desktop.
AutoIP for PiKVM
#!/bin/bash
# Define the interface name and the temporary IP address
INTERFACE="eth0" # Replace with the correct network interface name if it's different
TEMP_IP="192.168.1.100/24" # Replace with the desired temporary IP address
# Check for an IPv4 address on the interface
check_ip() {
ip addr show $INTERFACE | grep -q "inet "
}
# Wait for 30 seconds to allow the interface to come up
sleep 30
# Check if an IP address is assigned
if ! check_ip; then
# Assign a temporary IP address
ip addr add $TEMP_IP dev $INTERFACE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment