Pietro Staeheli writes ("Bug#855703: xen-create-image: doesn't create random
MAC addresses"):
> xen-create-image derives its generated MAC addresses from the hostname, IP
> address configuration and distribution of the domU to be installed (see: sub
> generateMACAddress). This behavior leads to a MAC address collisions when
> multiple domU's with the same configuration and hostname are created on the
> same network on different dom0's.
Hi. Thanks for your contribution. FYI, I am not the maintainer of
this package - I'm just another user, although I am involved with Xen
upstream and take an interest.
I think what you are doing is a bit odd. I would almost expect the
two identically named VMs to be failover for each other or something.
(If they share a hostname, do they share IPv6 and IPv4 addresses?)
Anyway, I'll assume you have a good reason...
> I've written a patch to add an option (--randommac) to generate a random MAC.
Firstly, IMO such an option is not harmful, but its use should be
discouraged. And it probably isn't the right answer for you. More
detailed explanation of why, below.
Perhaps a better approach would be to add the dom0 nodename to the
inputs to the existing calculation ? (I haven't looked at the code to
see if that would be practical.)
If you do generate a random MAC address, you should not generate it as
48 random bits. Ethernet addresses have structure. See:
https://en.wikipedia.org/wiki/Mac_address
I think at the very least you want to force the bits representing
"unicast" and "locally administered".
More on why not to do this:
When used in automation, actual randomness can lead to random
failures. With a 46-bits-of-random MAC address, collisions start to
have nonnegligible probability at around 10^5 hosts (dependong on your
definition of "nonnegligible probability").
If you want to perserver with the random generate idea I suggest the
addition of some caveat to the documentation.
Regards,
Ian.