Allow persist MAC addresses for bridged interfaces. Fixes #287

This commit is contained in:
Martin Wimpress 2022-08-19 21:15:36 +01:00
parent 8bb24f69c0
commit 2e15b1219f
No known key found for this signature in database
GPG key ID: 61DF940515E06DA3
3 changed files with 30 additions and 4 deletions

View file

@ -1008,8 +1008,15 @@ function vm_boot() {
elif [ -n "${network}" ]; then
# Enable bridge mode networking
echo " - Network: Bridged (${network})"
# If a persistent MAC address is provided, use it.
local MAC=""
if [ -n "${macaddr}" ]; then
MAC=",mac=${macaddr}"
fi
# shellcheck disable=SC2054,SC2206
args+=(-nic bridge,br=${network},model=virtio-net-pci)
args+=(-nic bridge,br=${network},model=virtio-net-pci${MAC})
else
echo " - Network: User (${NET_DEVICE})"
# shellcheck disable=SC2054,SC2206
@ -1418,6 +1425,7 @@ floppy=""
guest_os="linux"
img=""
iso=""
macaddr=""
macos_release=""
network=""
port_forwards=()