virtmac {IP Address} [{IP Address} ...]
The MAC address is generated using the following technique:
1) Convert the IP address into hex for use as the lower four bytes 2) Use the current time for the first two bytes: |4 bits|6 bits |6 bits | HH MM SS 3) Set the local administration bit (2nd least-significant bit of the first byte) to '1' 4) Set the unicast bit to '0' (least-significant bit of the first byte)
The uniqueness and non-repeatability of this MAC is based on the following rationale: the IP address of any given machine must be unique within any given broadcast domain, so using it as the basis of a MAC address seems to be a logical extension. Setting the local administration bit also guarantees that there will be no conflicts between the virtual MAC and any officially registered hardware manufacturer OIDs.
I've also tried to anticipate the likelihood that a machine might be readdressed after deployment, and a new machine with a virtual MAC being deployed on the old IP address. I've introduced two ``random'' elements into the full MAC address. The first is by using the MAC generation time stamp (12hr hours, minutes, and seconds). Unless you're generating a virtual MAC for the same IP at the exact same second of the given hour the addresses will remain unique on the network. The second random element is replacing the first octet of the network address with a random number.
While none of this is a guarantee that the MAC address will be globally unique, it should be sufficient for 99% of your use-case scenarios. In essence you have three bytes of ``randomness'' (well, 23 bits, anyway) attached to a locally unique IP address.
(c) 2009, Arthur Corliss (corliss@digitalmages.com)
Copyright © 1997 - 2016, Arthur Corliss, all rights reserved.