Modify the MAC address of CentOS

Source: Internet
Author: User
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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.