l2shift
NAME
l2shift: Spoof or rotate a MAC address in one command.
SYNOPSIS
sudo l2shift <interface> [mac]
DESCRIPTION
l2shift changes the Layer 2 address of a network interface, either to a value you pass or to a random one it generates. It is written in C, has no dependencies on most systems, and runs on Linux and macOS.
DEMO
FEATURES
- Random MAC generation when no address is given
- Custom MAC in the same single command
- Linux and macOS from one small C codebase
- Random MACs are always unicast and locally administered
NOTES
On Linux l2shift sets the address with ioctl syscalls directly; on macOS it goes through ifconfig. Random addresses clear the multicast bit and set the locally administered bit, so the result is always a valid unicast MAC. Custom input is accepted with any separators, but it must be exactly 12 hex digits and never all zeros or all F.
STACK
c, linux, macos