Randomize mac address when cloning a VM
Describe the issue
I have one base Linux VM with basic things set up; I tend to clone it and rename it whenever I need to spin up an experimental VM, or a VM per project.
Recently I noticed that when I have a VM running and I start a new one, all TCP/IP connections on the first VM will stop working - they won't close but no data will be transmitted, and will appear frozen.
Just today I realized that all VMs are using shared networking and all have same mac address. When I changed the mac address to a random one, the problem disappeared.
I think the best solution would be: when a VM is cloned and it uses Shared Networking, change the mac address to a random one.
To reproduce:
- Create a Linux VM, with Shared networking
- Clone it two times, into VM1 and VM2. Observe that all three VMs have the same mac address.
- Start VM1 and ssh to some remote server
- Start VM2
- Observe that the ssh connection in VM1 is dead.
Configuration
- UTM Version: 4.6.4 (107) from App Store
- macOS Version: 15.3.1 (24D70)
- Mac Chip (Intel, M1, ...): M3 Max
This was done specifically because people complained about network not working after cloning a VM because of the same mac address: https://github.com/utmapp/UTM/issues/2724
I'll take into consideration if shared networking is used or not.
Following.
In VMware/vSphere if you clone a vm, it automatically assigns a new mac address to the cloned vm. It would be nice if UTM did this.
I realize that adding an option adds friction, but maybe a checkbox in UTM settings for "regenerate MAC address when cloning" ?
Currently changing the MAC address can break some OS or software activation or device identification; when I clone a VM I usually don't want the MAC to change, because I'm testing something temporarily and want to keep everything else the same.
(Actual snapshots/rollback would solve this issue for my particular usecase, perhaps for others as well).
@ideologysec I would be happy with that solution.