One of our customers uses a piece of software that depends on the MAC address of the running system. Unfortunately this application misbehaves when used on Amazon EC2 cloud computing, as each EC2 instance has an arbitrary MAC address that cannot be altered. Therefore we have written a small piece of software called fakemac.
fakemac acts as a wrapper around an application and uses LD_PRELOAD to load a small library that overloads the ioctl() function. When it sees requests to SIOCGIFHWADDR, it alters the returned data by overwriting the MAC address.
The fakemac program can be used as follows:
$ fakemac 42:42:42:42:42:42 ifconfig | grep HWaddr eth0 Link encap:Ethernet HWaddr 42:42:42:42:42:42 wlan0 Link encap:Ethernet HWaddr 42:42:42:42:42:42
As always, the source code has been published on GitHub.