Home > System Tutorial > LINUX > body text

How to change MAC address in Linux

WBOY
Release: 2024-02-13 12:00:32
forward
1120 people have browsed it

Change MAC address

Sometimes, we may not want our real MAC address (physical address) to be exposed on the public network. Alternatively, the network administrator may block a specific MAC address. This article will introduce how to use the macchanger tool to change the MAC address.

environment

  • Centos 7.7 Minimal
  • GNU MAC changer 1.7.0

Query network card and MAC address

Use the following command to query the network card and MAC address:

sql复制代码[root@localhost ~]# ip link show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33:  mtu 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
Copy after login
How to change MAC address in Linux

Record your MAC address, and then restore it to the original MAC address after completing the experiment.

Use the macchanger tool to change the MAC address

macchanger can view and modify the MAC address.

Install macchanger

Use the following command to install macchanger:

graphql复制代码[root@localhost ~]# git clone https://github.com/alobbs/macchanger
[root@localhost ~]# yum -y install autoconf automake gcc gcc-c++ texinfo
Copy after login

How to use macchanger

The following command will generate a random MAC address and apply it to the ens33 network card:

r复制代码[root@localhost ~]# macchanger -r ens33
Current 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)
Copy after login
How to change MAC address in Linux

Use the following command to check whether the MAC address of ens33 has changed:

sql复制代码[root@localhost ~]# ip link show ens33
2: 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
Copy after login
How to change MAC address in Linux

To change to the specified MAC address, please use the following command:

csharp复制代码
[root@localhost ~]# macchanger --mac=XX:XX:XX:XX:XX:XX
Copy after login

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

r复制代码[root@localhost ~]# macchanger -p ens33
Current 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.)
Copy after login
How to change MAC address in Linux

Summarize

This article explains why you want to change your MAC address and how to use the macchanger tool to do it.

The above is the detailed content of How to change MAC address in Linux. For more information, please follow other related articles on the PHP Chinese website!

source:lxlinux.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template