Fixing eth1 ip detection logic

Interfaces can have multiple IP addresses, causing this step to fail in Virtualbox
This commit is contained in:
Chris Long
2020-04-18 22:53:35 -07:00
committed by GitHub
parent 78130b2b78
commit 203d7a4638

View File

@@ -88,7 +88,7 @@ fix_eth1_static_ip() {
}' >>/etc/dhcp/dhclient.conf
netplan apply
# Fix eth1 if the IP isn't set correctly
ETH1_IP=$(ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
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