Many software applications need to bind MAC addresses (for example, OpenCountry). sometimes we need to modify the MAC address of the NIC for special purposes. 1. Method 1: Use the command to temporarily modify: ifconfigeth0downifconfigeth0hwetherxx: xx: xxifconfigeth0up2. Method 2: as long as the MAC address of the NIC is modified before the network is started, the specified M is used after the system is started.
Many software applications need to bind MAC addresses (for example, OpenCountry). sometimes we need to modify the MAC address of the NIC for special purposes.
1. Method 1:
Use the command to temporarily modify:
Ifconfig eth0 down
Ifconfig eth0 hw ether xx: xx
Ifconfig eth0 up
2. Method 2:
As long as the MAC address of the NIC is modified before the network is started, the specified MAC address is used after the system is started. Modify/etc/rc. d/rc. sysinit and add:
Reference ifconfig eth0 down
Ifconfig eth0 hw ether xx: xx
Ifconfig eth0 up
3. Method 3:
By analyzing the/sbin/ifup script, we can know the simplest way: modify/etc/sysconfig/network-scripts/ifcfg-eth0:
Reference MACADDR = xx: xx
Restart the network service to ensure that the MAC address is still used after the system is restarted.
※Differences between HWADDR and MACADDR
Reference HWADDR =, where the hardware address of an Ethernet device in the form of AA: BB: CC: DD: EE: FF. this field is very useful on machines with multiple Nic devices. it ensures that the device interface is assigned the correct device name, regardless of the loading sequence configured for each Nic module. this field cannot be used with MACADDR.
MACADDR =, where the hardware address of an Ethernet device in the form of AA: BB: CC: DD: EE: FF. on a machine with multiple Nic devices. this field is used to assign a MAC address to an interface to overwrite the MAC address allocated physically. this field cannot be used with HWADDR.
Understand the differences between HWADDR and MACADDR. The former is used to bind the ethX name based on HWADDR, and the latter is used to modify the MAC address.