cloud-init: pass VM's mac address to cloud-init

marpe7

New Member
Aug 25, 2023
2
0
1
Hi,

how to make cloud-init network configuration (with a static IP) to dynamically use the VMs mac address (as in VMs Hardware) without needing to explicitly specify the mac address again in the network.yaml config (via `cicustom`)?

When i don't specify any mac address in the cloud-init network config (v1), it will not generate a valid netplan config (missing mac match rule).

I am using PVE 8, latest Ubuntu jammy cloud-init image.

Thanks.
Marpe
 
If there is no way to achieve this with the custom-config files, is there maybe a scripting solution to obtain the VM's mac address and pass it to cloud-init?

Technically it is already possible if not using custom-config files ('cicustom') if using the settings in the PVE's UI VM menu 'cloud-init' section: the VM's MAC is automatically applied in the VM's resulting cloud-init network config. I'm looking for a way using config files (preferably) or scripting.
 
Last edited: