diff --git a/src/network.sh b/src/network.sh index bf47a071..d6819a43 100644 --- a/src/network.sh +++ b/src/network.sh @@ -239,8 +239,14 @@ getInfo() { fi if [ -z "$MAC" ]; then - # Generate MAC address based on Docker container ID in hostname - MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/') + local file="$STORAGE/$PROCESS.mac" + if [ -f "$file" ]; then + MAC=$(<"$file") + else + # Generate MAC address based on Docker container ID in hostname + MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/') + echo "${MAC^^}" > "$file" + fi fi VM_NET_MAC="${MAC^^}"