Centos Mac Modification
Add a line in the file/etc/sysconfig/network-scripts/ifcfg-eth0 similar to the following
MACADDR = 00: 04: AC: 33: 1C: 3B
A: The MAC address is the physical address of the NIC. You can change the MAC address in Linux:
1) Close the NIC Device
/Sbin/ifconfig eth0 down
2) modify the MAC address
/Sbin/ifconfig eth0 hw ether MAC address
3) restart the NIC
/Sbin/ifconfig eth0 up
How to modify the nic mac address in Red Hat Linux
OS Version: Red Hat Enterprise Linux AS4
Core: Kernel 2.6.9-42
There are many ways to modify the MAC address in linux on the Internet, most of which are based on Huludao. They do not seem to have been verified and cannot be modified.
After my detailed tests, the problem was finally solved successfully.
Misunderstanding 1:
# Ifconfig eth0 down/* disable eth0 Nic. Here, the eth0 Nic is used as an example */
# Ifconfig eth0 hw ether 00: AA: BB: CC: DD: EE/* modify the MAC address of the eth0 Nic */
# Ifconfig eth0 up/* restart eth0 Nic */
Then restart the host.
Conclusion: According to this method, the MAC address is automatically restored after the host system is restarted.
Misunderstanding 2:
# Ifconfig eth0 down
# Cd/etc/sysconfig/network-scripts
# Vi ifcfg-eth0
Modify "HWADDR = xx: xx"
# Ifconfig eth0 up
# Service network start
Conclusion: The network cannot be enabled after the MAC address is modified according to this method, and the following prompt appears:
"Bringing up interface eth0: Device eth0 has different MAC address than expected, ignoring ."
In linux, how can I ensure that the modified MAC address is permanently saved? The correct steps are as follows:
# Ifconfig eth0 down
# Cd/etc/sysconfig/network-scripts
# Vi ifcfg-eth0
Modify "HWADDR = xx: xx" to "MACADDR = xx: xx"
# Ifconfig eth0 up
# Service network start
Keywords: HWADDR and MACADDR are different.