Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify the Mac address of network card in centos system of CVM

Shulou Source: shulou.com Published: 2022-06-01 08:38:50 10月03日 Update

In this issue, the editor will bring you about how to modify the Mac address of the network card in the centos system of the CVM. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

The CVM adds a line in the file / etc/sysconfig/network-scripts/ifcfg-eth0 similar to the following

   MACADDR=00:04:AC:33:1C:3B

  : the MAC address is the physical address of the Nic. In fact, the MAC address can also be changed under Linux:

   1) closed network card equipment

   / sbin/ifconfig eth0 down

   2) modify MAC address

   / sbin/ifconfig eth0 hw ether MAC address

   3) restart the network card

   / sbin/ifconfig eth0 up

How to modify the MAC address of network card under    Red Hat Linux

   OS version: Red Hat Enterprise Linux AS4

   Core: Kernel 2.6.9-42

On   , there are many ways to modify MAC addresses under linux, most of which seem to have not been verified and can not achieve the purpose of modification.

After detailed testing by Xiao Yun Xiaobian,    finally successfully solved this problem.

   misunderstanding 1:

   # ifconfig eth0 down / disable the eth0 Nic. Take the eth0 Nic 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 the eth0 Nic /

   then restarts the host.

   conclusion: the MAC address is modified in this way, and when the host system is restarted, the MAC address will be restored automatically.

Misunderstanding 2 of   :

   # ifconfig eth0 down

   # cd / etc/sysconfig/network-scripts

   # vi ifcfg-eth0

   modifies "HWADDR=xx:xx:xx:xx:xx:xx" in it

   # ifconfig eth0 up

   # service network start

   conclusion: the network cannot be enabled after the MAC address is modified in this way, and the following prompt appears:

   "Bringing up interface eth0: Device eth0 has different MAC address than expected,ignoring."

  , how to ensure the permanent preservation of the modified MAC address in the linux environment? The correct steps are as follows?

   # ifconfig eth0 down

   # cd / etc/sysconfig/network-scripts

   # vi ifcfg-eth0

   changed "HWADDR=xx:xx:xx:xx:xx:xx" to "MACADDR=xx:xx:xx:xx:xx:xx"

   # ifconfig eth0 up

   # service network start

   keywords: there is a difference between HWADDR and MACADDR.

This is how the cloud host centos system shared by the editor modifies the Mac address of the network card. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Address network card host system method content conclusion misunderstanding analysis success according to the gourd line professional small and medium key words rich content that is files articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Linux Shulou Tech Info vpn Huawei