Add the ability to use the hyperv provider.

This commit is contained in:
man715
2020-08-25 13:03:34 -07:00
parent 85a5990b2f
commit 53b0ec43a3
11 changed files with 885 additions and 0 deletions

18
HyperV/check-eth0-ip.sh Normal file
View File

@@ -0,0 +1,18 @@
check_eth0_ip() {
ETH1_IP=$(ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1)
if [ "$ETH1_IP" != "192.168.38.105" ]; then
echo "Incorrect IP Address settings detected. Attempting to fix."
ifdown eth1
ip addr flush dev eth1
ifup eth1
ETH1_IP=$(ifconfig eth1 | grep 'inet addr' | cut -d ':' -f 2 | cut -d ' ' -f 1)
if [ "$ETH1_IP" == "192.168.38.105" ]; then
echo "[$(date +%H:%M:%S)]: The static IP has been fixed and set to 192.168.38.105"
else
echo "[$(date +%H:%M:%S)]: Failed to fix the broken static IP for eth1. Exiting because this will cause problems with other VMs."
exit 1
fi
fi
}
check_eth0_ip