Sometimes, we need to modify the MAC address of the ethernet card for some reason. For example, the SJTU network requires the MAC address to be static. In that case, we may modify the MAC address of the ethernet card in the operating system to simulate a different hardware card and pass the check.
Linux system has provided the basic tool ifconfig to help us, and we can finish the modification in following commands.
# shut down the desired ethernet interface.
(root)# ifconfig eth0 down
# modify the MAC address.
(root)# ifconfig eth0 hw ether 00:00:00:00:00:01
# reactive the ethernet interface.
(root)# ifconfig eth0 up
This change is not permanent as the MAC address on the interface eth0 will revert to the default on the next system reboot. If you need the operating system to change the MAC address everytime when booting, please modify the configuration file /etc/network/interfaces.
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether 08:00:00:00:00:01