Thursday, November 24, 2011

How to Change MAC Address on RHEL/CentOS/Fedora

On the RHEL/CentOS/Fedora boxes, there is a line named HWADDR in the interface configuration file /etc/sysconfig/network-scripts/ifcfg-eth0, for example, storing the MAC address of the corresponding ethernet interface.

Nothing will happen if you change the MAC addresss in this line, and you will probably receive the following notice when restart the network service.

Shutting down interface eth0:  Device eth0 has MAC address AA:BB:CC:DD:EE:FF, instead of configured address 00:11:22:33:44:55. Ignoring.

To change the MAC address, just keep the HWADDR as it is, and add the following line to the above file.

MACADDR=00:11:22:33:44:55

Restart the network service.

# service network restart
# ifconfig eth0

New MAC address! Congrats!!!

Note: You should change eth0 to eth1, or the Ethernet interface you want to change its MAC address.

3 comments:

Unknown said...

Great post . thanks for providing such important information about MAC Address
Spoof MAC Address

sonvxblog said...

For more information about this issue: I guess the root of problem is because the previous MAC address is stored in

/etc/udev/rules.d/70-persistent-net.rules

Thus you can edit your desired MAC address in here also or simply delete this file to make your system generates it again.

Unknown said...

sonvxblog, thanks for your comments!

By the way, I wonder how to do it without restarting the server?