This commit is contained in:
Kroese 2023-04-19 22:23:31 +02:00 committed by GitHub
parent 81ed762dc5
commit 96d6caafb1

View File

@ -26,8 +26,8 @@ configureMacVlan () {
ip a flush eth0 ip a flush eth0
ip a flush ${VM_NET_TAP} ip a flush ${VM_NET_TAP}
dhclient -v ${VM_NET_TAP} udhcpc -v ${VM_NET_TAP}
_DhcpIP=$( dhclient -v ${VM_NET_TAP} 2>&1 | grep ^bound | cut -d' ' -f3 ) _DhcpIP=$( udhcpc -v ${VM_NET_TAP} 2>&1 | grep ^bound | cut -d' ' -f3 )
[[ "${_DhcpIP}" == [0-9.]* ]] \ [[ "${_DhcpIP}" == [0-9.]* ]] \
&& echo "Info: Retrieved IP: ${_DhcpIP} from DHCP with MAC: ${VM_NET_MAC}" \ && echo "Info: Retrieved IP: ${_DhcpIP} from DHCP with MAC: ${VM_NET_MAC}" \
|| ( echo "ERROR: Cannot retrieve IP from DHCP with MAC: ${VM_NET_MAC}" && exit 16 ) || ( echo "ERROR: Cannot retrieve IP from DHCP with MAC: ${VM_NET_MAC}" && exit 16 )