[CentOS] Cloning bridged VMs : VirtualBox vs. KVM

Thu Mar 25 04:43:27 UTC 2021
Rob Kampen <rkampen at kampensonline.com>

On 25/03/21 5:51 am, Nicolas Kovacs wrote:
> Hi,
> (tl;dr : how can I clone a KVM-based bridged virtual machine and force a
> duplicate MAC address ?)
> Up until recently I've been using VirtualBox on my workstation to test various
> local setups. Usually I would setup a basic CentOS installation, and whenever I
> wanted to fiddle around, I would just clone that system and play around with
> it. So whenever I shot myself in the foot on that VM, I would simply erase it
> and start over again with a new clone. Think of it as a disposable VM.
> All my VMs under VirtualBox used bridged mode, so they were in the same
> network. And in my local proxy server, I have Dnsmasq that assigns static IP
> addresses and meaningful hostnames to these VMs. Here's what the corresponding
> lines in dnsmasq.conf look like:
> dhcp-host=08:00:27:00:00:01,suse-lp151,
> dhcp-host=08:00:27:00:00:02,suse-lp152,
> dhcp-host=08:00:27:00:00:03,ce7-server,
> dhcp-host=08:00:27:00:00:04,ce8-server,
> dhcp-host=08:00:27:00:00:05,ol7-server,
> dhcp-host=08:00:27:00:00:06,ol8-server,
> dhcp-host=08:00:27:00:00:07,rh7-server,
> dhcp-host=08:00:27:00:00:08,rh8-server,

this appears to have 8 different mac addresses and then assigned 8 
individual IP addresses - that would appear desireable and correct.

Why do you want the same mac? what are you trying to achieve?

Feel like I'm missing something

> Over the last two weeks, I decided to migrate from VirtualBox to KVM even for
> local configurations and virtualized desktop configurations. So far, everything
> works nice... except one problem I can't seem to solve (yet).
> I'm using KVM in bridged mode, over a br0 bridge on my workstation. Like with
> VirtualBox, all my KVM virtual machines are part of my local
> network.
> Unfortunately there is no way to simply make a perfect clone of a virtual
> machine using virt-manager. It insists on assigning my cloned VM a different
> MAC address. And whenever I want to manually create a NIC with the same MAC
> address as the original, Virtual Machine Manager tells me I can't do that. Same
> player shoot again.
> Now I know that is normally a good thing. You don't want MAC address conflicts
> in your network. But here's the thing: I don't intend to fire up both copies at
> once. As with VirtualBox, I only intend to use one VM at a time, for testing
> purposes. Now how can I "explain" this to Virtual Machine Manager without
> having to jump through burning loops ?
> Cheers,
> Niki