I'm starting three Qemu VMs, each with several network interfaces. The network interface config looks like this:
-nic user,hostfwd=tcp::"${ssh_ports[$machine]}"-:22,model=virtio-net-pci \
-nic bridge,br="${bridge1}",model=virtio-net-pci
...
In all machines, I find that the first network device's MAC address is 52:54:00:12:34:56
, the second ...:57
, the third ...:58
and so on. This leads to a conflict of MAC addresses between my VMs. How can I let Qemu randomly assign the MAC addresses?
PS:
- Not sure if this is relevant: I have two bridge interfaces, and each VM has one network interface in the first bridge, and one network interface in the second bridge.
- I could of course use bash to generate some random number and then explicitly set it as a parameter. I would find it nicer if Qemu would just do that itself though.
- A quick search revealed questions from people that wanted to reach the opposite: have Qemu assign some predetermined MAC. Those questions sounded like random assignment of MAC addresses is actually the default.