[xen-tools-discuss] xen-create-image (Debian Jessie, xen-tools 4.5-1) and duplicate MAC addresses

Axel Beckert abe at deuxchevaux.org
Fri Feb 17 16:27:45 CET 2017


Hi Pietro,

Pietro Stäheli schrieb am Fri, Feb 17, 2017 at 03:42:48PM +0100:
> I found out yesterday that xen-create-image generates MAC addresses
> derived from command-line arguments (specifically hostname, IP/DCHP,
> distribution, see sub generateMACAddress in xen-create-image). This will
> lead to two domU's created with the same hostname and distribution, both
> configured with DHCP or the same IP address to have the same MAC
> address.

Correct.

> This predictably leads to unpredictable things happening when
> those two domU's are started on the same network. Switches start
> catching on fire, reality folds in on itself, etcetera.

Of course.

> I would like to ask if this is intended behavior and the reasoning
> behind doing it this way, before filing a bug report.

This is on purpose. The code makes two assumptions:

* If I regenerate a host with the same hostname/IP/DHCP, it's usually
  a reinstallation of the same DomU and this implies that it should
  get the same MAC address, too.

  Reasoning here: You'll get mad with MAC based security if a
  throw-away DomU gets a new MAC address upon every reinstallation.

* Two machines running at the same time in the same LAN have never the
  same hostname.

It seems the latter is not given in your case. I must admit, I still
can't imagine a setup where this is not given (i.e. I would have said
the reasoning for this is "common sense" ;-), so I'd be curious about
the setup to understand what's needed to fix this.

> Naturally, only a monumentally stupid person would actually have two
> hosts with the same hostname on the same network,

Ah, there it is: common sense. ;-)

> which is probably why this happened to me. But still, would it not
> be sensible to add some amount of randomness to the generation of
> the MAC address?

IMHO not for the reasons mentioned above (reinstallation, setups with
MAC based security).

> Just randomizing one octet of the MAC would make
> running into this problem far less likely. Randomizing the addresses
> entirely would also make them reasonably unique.

As MAC addresses are split in vendor and local part, at least the
default should abide to common rules and always use the same vendor
part. (It's the vendor part of The Xen Project™.)

> Browsing through the source of xen-tools 4.7 seems to indicate that this
> function hasn't changed in the new version either.

Nope. But there's an open issue which is about changing the logic
behind the MAC address generation — but the idea there is to even
remove one of the sources for generating the random part, i.e. to make
it even less random than before:
https://github.com/xen-tools/xen-tools/issues/33

It seems to me that we need an additional option (and configuration
file directive) which defines how the MAC address is generated.

So please, yes, file a bug report for this issue.

		Regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe at deuxchevaux.org  (Mail)
 X   See http://arc.pasp.de/                      | abe at noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)


More information about the xen-tools-discuss mailing list