When I create new qemu vm in proxmox, I prefer clone from a template becase this way is faster. The template comes from vm which I have booted once and made some modification. My pve is running on a n3350 mini pc, the performance is miserable when building a new vm scratch from an disk image. But it can handle tens of running vms without problem, as long as the vm is not doing some heavy computing.
The problem is, every time I clone a template, when booting the cloned vm, the first dhcp packet seems coming from cloud-init, and at that time, network stack has not start up so there is no mac address available for cloud-init to read. So it seems cloud-init will read from a file, /etc/machine-id, as a mac address to send first dhcp request. That poses a problem: the machine-id of every cloned vm is same. The solution is: empty the file /etc/machine-id, it seems cloud-init will regenerate one if it is empty. Different vms have different names, and we want to resolve vm's ip by its name. The problem is: in proxmox, the snippets defined variables seems have higher priority than settings in the cloud-init section in the settings of vm and name of the vm(consider hostname). The solution is: modify the snippets file instead of relying on the name of the vm to modify hostname.
It took me a long way to finally got these two pieces of solution. I have tried many other ways, but it seems this is the best for me now.