Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the MAC physical address of the network card under Linux

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to change the MAC physical address of the network card under Linux". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it together to study and learn "how to change the MAC physical address of the network card under Linux"!

In some places, the network address and the physical address of the network card are bound. When changing the network card or other computers, the network may not be available. Here is how to change the physical address (MAC Address). Divided into temporary changes and long-term changes in two cases, two methods do not actually change the real properties of the network card.

temporarily change

The so-called temporary change refers to a short-term change method that fails after restarting the system. It is simpler.

The physical address of a Linux NIC is set during network setup.

First, make sure you are using root. Suppose eth0 is set.

Network card first "close"

# ifconfig eth0 down

Change the physical address and replace the bold part with the MAC address you want to change:

# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

Enable eth0.

# ifconfig eth0 up

If necessary, add your own commands to join the route.

Note:

If you want to set other information such as IP, be sure to put the hw ether physical address immediately after the device name (such as eth0).

Long-term changes

This refers to the ability to retain changes after a restart. A text editor profile is required.

Debian (Ubuntu is probably in this column too)

Edit/etc/network/interfaces, find the place related to eth0, and modify it to something like:

allow-hotplug eth0

iface eth0 inet dhcp

#iface eth0 inet static

# address 1.1.1.6

# netmask 255.255.255.0

# gateway 1.1.1.1

hwaddress ether 00:AA:BB:CC:DD:EE

The annotated part is the static IP, and the current unannotated part is the dynamic IP. See Debian Network Settings for details

Archlinux or Gentoo

Edit/etc/rc.conf (Archlinux) or/etc/conf.d/net (Gentoo) to add hw ether 00:AA:BB:CC:DD:EE to the eth0 configuration string. For Gentoo and Archlinux network settings, see the documentation for your distribution.

Fedora or Redhat

Edit/etc/sysconfig/network-scripts/ifcfg-eth0 (modify eth0 to your NIC number if necessary), add or modify

HWADDR=AA:BB:CC:DD:EE:FF

That's it.

Thank you for reading, the above is "how to change the MAC physical address of the network card under Linux" content, after the study of this article, I believe we have a deeper understanding of how to change the MAC physical address of the network card under Linux, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report