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 MAC address in Linux

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

Share

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

This article mainly introduces "how to change the MAC address in Linux". In the daily operation, I believe many people have doubts about how to change the MAC address in Linux. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "how to change the MAC address in Linux". Next, please follow the editor to study!

Environment

Centos7.7 Minimal

GNU MAC changer 1.7.0

Query network card and MAC address

[root@localhost ~] # ip link show1: lo:mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:0c:29:48:4c:9a brd ff:ff:ff:ff:ff:ff

The name of the network card is ens33,MAC and the address is 00:0c:29:48:4c:9a. Please write down your MAC address and restore it to the original MAC address after the experiment.

Use the macchanger tool to change the MAC address

Macchanger can view and modify MAC addresses.

Install macchanger

[root@localhost ~] # git clone https://github.com/alobbs/macchanger[root@localhost ~] # yum-y install autoconf automake gcc gcc-c++ texinfo

How to use macchanger

Use the following command to generate a random mac address for the ens33 Nic:

[root@localhost] # macchanger-r ens33Current MAC: 00:0c:29:48:4c:9a (VMware, Inc.) Permanent MAC: 00:0c:29:48:4c:9a (VMware, Inc.) New MAC: a2:97:a2:55:53:be (unknown)

Check to see if the MAC address of ens33 has changed

[root@localhost ~] # ip link show ens332: ens33:mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether a2:97:a2:55:53:be brd ff:ff:ff:ff:ff:ff

You can change it to a self-specified mac address, using the following command:

[root@localhost] # macchanger-- mac=XX:XX:XX:XX:XX:XX

If you want to restore to the real MAC address, use the following command:

[root@localhost] # macchanger-p ens33Current MAC: a2:97:a2:55:53:be (unknown) Permanent MAC: 00:0c:29:48:4c:9a (VMware, Inc.) New MAC: 00:0c:29:48:4c:9a (VMware, Inc.)

At this point, the study on "how to change the MAC address in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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