What is a MAC address?
A MAC (media access control) address is the 48-bit hardware identifier of a network interface, written as six bytes in hexadecimal. Manufacturers assign addresses from blocks they own: the first three bytes, the OUI, identify the vendor. This random MAC address generator creates addresses for virtual machines, containers, lab networks and test data.
Formats
Colon (Linux, macOS): 6A:3F:0B:C2:91:E4
Hyphen (Windows): 6A-3F-0B-C2-91-E4
Cisco dot notation: 6a3f.0bc2.91e4
No separator: 6A3F0BC291E4
Unicast and locally administered bits
Two bits in the first byte have special meaning:
- Bit 0 (I/G) – 0 means unicast (one device), 1 means multicast. The generator always clears it, because a network card must not use a multicast address.
- Bit 1 (U/L) – 0 means universally administered (assigned by a vendor), 1 means locally administered (set by software or an administrator).
With the locally administered option on (the default), the second hex digit of every address is 2, 6, A or E. Such addresses cannot clash with real hardware, which is why hypervisors, container runtimes and phone privacy features use them. Turn the option off only if you specifically need addresses that look vendor-assigned; they may then collide with real vendor prefixes.
Common uses for a random MAC address generator
- Assigning stable MAC addresses to virtual machines in libvirt/KVM, VirtualBox or Hyper-V configurations.
- Testing MAC address validation and normalization code, which must accept all four formats above.
- Seeding network inventory, DHCP reservation or asset-management demo data.
- Documentation and screenshots that should not reveal real hardware addresses.
Reading the vendor prefix
In a vendor-assigned address such as 00:1A:2B:3C:4D:5E, the first three bytes (00:1A:2B) form the OUI registered with the IEEE, and the last three are chosen by the manufacturer. Because generated addresses have the locally administered bit set, an OUI lookup will not match any vendor, which is exactly what you want for test data.
Applying a generated address
# Linux: change an interface's MAC (bring it down first)
ip link set dev eth0 down
ip link set dev eth0 address 02:1a:2b:3c:4d:5e
ip link set dev eth0 up
# QEMU/KVM guest network card
-device virtio-net-pci,netdev=n0,mac=52:54:00:12:34:56
# Docker container
docker run --mac-address 02:42:ac:11:00:02 nginxQEMU's conventional prefix 52:54:00 is itself locally administered: 0x52 is binary 01010010, so the U/L bit is set and the I/G bit is clear. A change made with ip link lasts until the next reboot unless you also add it to your network configuration.
Good to know
MAC addresses are only meaningful within a local network segment and are not sent across the internet. Changing the MAC address of your own device may break DHCP reservations or network access policies, and some networks prohibit it, so only use generated addresses in environments you manage.
Build a full set of network test data with the random IP address generator, or convert values between bases with hex to binary to inspect the individual bits.