Changing Your MAC Address/Linux
Under Linux, the MAC address of a network interface card (NIC) can be changed by doing the following. Note that you must be root in order for this to work:
ifconfig eth0 hw ether 02:01:02:03:04:08
Under Fedora Core 5, and possibly in other Linux distributions, to disable and restart networking, one must stop and start
/etc/init.d/network, instead of
/etc/init.d/networking. If you have the Iproute2 tools installed, you may prefer to use the
ip command instead:
ip link set eth0 address 02:01:02:03:04:08
To confirm your setting you may prefer to use
ip link ls eth0 or
ip addr ls eth0 instead of using
NOTE: You may not be able do this if using a DSL modem (depending on modem vendor or ISP).
In Red Hat Linux and other similar systems (Fedora Core, etc.) an easy way to make it "permanent" across reboots is to just add a variable like this to the ifcfg-eth0 or similar file:
Upper or lower case on the MAC address are fine, because the network function converts it to upper case.
service network restart for prompt results.
In Debian just put
hwaddress ether 02:01:02:03:04:08
in the appropriate section of /etc/network/interfaces so that the MAC address is set when the network device is started.
In Gentoo you can do this in global configuration file /etc/conf.d/net for each ethernet card. Example for eth0 device:
You can also use the tool MACChanger to change the MAC address under Linux.
To change MAC address during boot time with MACChanger,add the following line to your /etc/network/interfaces
pre-up macchanger -m 12:34:56:78:90:AB eth0