Change the MAC address in Linux and Mac OS X

Change the MAC address in Linux

To change your MAC address in Linux run the following script commands:

ifconfig down

ifconfig hw

ifconfig up


The first command brings down the network interface The second command change its MAC address. The third command bring up the interface again.

NOTE: In some cases, to bring down and bring up the network interface, the following commands have to be used:

/etc/init.d/networking stop or /etc/init.d/network stop (in the case of Fedora Core 5)

/etc/init.d/networking start or /etc/init.d/network stop
(in the case of Fedora Core 5)

For Fedora Code 5 Linux with Iproute2 tools installed, the following commands also can change the MAC address to spoofed version:

/etc/init.d/network stop

ip link set address 1A:2B:3C:4D:5E:6F

/etc/init.d/network start


Change the MAC address in Mac OS X

Since Mac OS X 10.4.x (Darwin 8.x) onwards, the MAC address of wired Ethernet interface can be altered in Apple Mac OS X in a fashion similar to the Linux and FreeBSD methods. Type the following command in Terminal:

sudo ifconfig en0 ether 00:AA:22:BB:22:CC

sudo ifconfig en0 lladdr 00:AA:22:BB:22:CC
(for Mac OS X 10.5 Leopard)

Where en0 is the network interface and 00:AA:22:BB:22:CC is the desired MAC address in hex notation.