0

When cloning a VirtualBox instance, is there a way to set the "Reinitialize the MAC address of all network cards" as the default?

Humans sometimes forget to tick this box, with the resulting horror of having different machines - on the same LAN - assigned the same IP address by the DHCP server.

  • 1
    I don't know a way to change defaults in the VirtualBox GUI (maybe there's a way; I just don't know of one). But if the humans are amenable to using the command-line VBoxManage program, its clonevm sub-command has defaults set the opposite regarding MAC addrs of the new clone: they're reinitialized by default. – sjnarv Sep 25 '18 at 3:19
  • Alas, @sjnarv, them users sure do love their GUI. Using the shell is just for us mere mortals. – boardrider Sep 25 '18 at 18:41
1

If you look at the CLI suggested in comments https://www.virtualbox.org/manual/ch08.html#vboxmanage-clonevm there is a flag for that there. Silly GUI, I definitely would like it to remember what I last did. I use to do that I think in Version 5, but 6 it started changing the network info by default on Clones.

--options keepallmacs

This page shows a usage example https://askubuntu.com/questions/510182/how-to-automatically-clone-a-vm

cd /VM_Storage
vboxmanage clonevm ImportantVM --name ImportantVM-02 --options keepallmacs --register

[ Note the register flag is pretty important to avoid more trouble later - see below ]

Of course if you're on windowz it's probably not in your shell's 'path', which you could fix, or you want to call this more directly via (probably in a script or something?)

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"

Oh but you won't see it in the GUI so you need to import or launch via CLI so that is also kind of annoying, again it sure would be better if it remembered my last setting in the GUI.

Maybe you want this in the background/headless at some point too

VBoxManage startvm "Ubuntu Server" --type headless

but that actually will have an error

VBoxManage.exe: error: Could not find a registered machine named

It seems you need --register in the clonevm command, maybe a little late for that so how to register?

Apparently you need to use registervm for that. Alas it seems that it won't know where to look even from that directory via relative path so then you'll need to either set

vboxmanage setproperty machinefolder /path/to/vm_directory/ or include the full path when registering. BTW there is also an unregistervm command. Oh wait... Unfortunately it still doesn't help... so you'll need the full path to register it.

I guess it's better to remember the register flag during clonevm command (I've changed it above to avoid trouble for people checking this nightmare out).

  • Also note to shutdown properly especially if headless was used use the command VBoxManage controlvm ImportantVM-02 acpipowerbutton – Master James Sep 3 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.