Created
April 3, 2025 11:46
-
-
Save boutzamat/834aec7c014eb981de3e15e4337eb558 to your computer and use it in GitHub Desktop.
AutoIP for PiKVM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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