1
I want to build a virtual machine (with some Linux distribution) with Virtualbox and then use the built virtual machine to somehow "derive" (for lack of a better term) other virtual machines from it without having to do the complete installation again (selecting language, keyboard map, installing software packages, etc.).
So let's say I have a basic virtual machine called "base" where I have configured all the necessary stuff that I need (ssh, vim, etc.). Then I want to use this basic vm to create a new one called "derived" and only have to change hostname and IP address of it without having to build the complete vm from scratch.
I thought that packer and vagrant would be the right tools for this. But unfortunately I have difficulties with vagrant. All methods I tried so far to achieve my goal failed because the new (derived) box always has the identical MAC address than the "base" box.
I tried the following all without success:
1. Setting vm.base_mac = nil
in my Vagrantfile: this removes the NAT interface eth0 and adds a 2nd NIC eth1 which is not configured
2. Doing provisioning with modifyvm --macaddress1 auto
: same result, this removes the NAT interface eth0 and adds a 2nd NIC eth1 which is not configured
3. Doing vagrant box add --name derived-box filepath-to-base-box
: the new box "derived-box" has the same MAC address as the "base" box
4. Doing vagrant box repackage ...
: same result, MAC address is identical to the base box
Questions:
1. Is it possible to do what I want with vagrant?
2. If yes, what steps do I have to take to get a new (derived) vagrant box from an existing vagrant box with a different MAC address and networking?