MAC Address Spoofing on Linux

Source: Internet
Author: User
Tags linux mint

MAC Address Spoofing on Linux
GuideThe NIC manufacturer marks a 48-bit GUID on each NIC (NIC) when it leaves the factory. This GUID is the MAC address of the NIC, used to determine the identity of a network card. The 24-bit high MAC address is called OUI, which is the identifier of the Organization that sets the MAC address for the NIC. As a result, the MAC addresses set for different organizations will not conflict. Although the MAC address is specified by the vendor, you can change it. This is the legendary "MAC Address Spoofing ".Why do you want to play MAC address spoofing?

Why? Here we will give you a few technical reasons. Some network vendors will bind the MAC address on your vro to verify your identity. What if your vro is broken at this time? You can temporarily change the MAC address of your computer to the MAC address of your vro, so that your ISP can re-connect you to the Internet. Is there such a thing ?)

Many DHCP servers rely on MAC addresses to allocate IP addresses. If you want to change the IP address assigned to you, you can change the MAC address. In this way, you don't have to wait for the DHCP server to allocate an IP address again, but you can get a new one immediately.

In addition to technical reasons, there are also some legitimate reasons to explain why you need to change your MAC address: for privacy, for security, you need to hide your real MAC address. Unlike the IP address on the third layer of the ISO model, your MAC address will not change. Before you say I have doubts, please be sure you know what your privacy is. There is an intrusion method called piggybacking. hackers may pretend to be your MAC address in the public WiFi network and pretend to be your identity when you are not present for hacking.

How can I temporarily change the MAC address?

You can change the MAC address when running Linux. Note that when the MAC address is switched, your network will be disconnected. When the computer restarts, the MAC address changes back to the original one. The following describes how to change your MAC address.

Method 1: iproute2
Method 1: iproute2 $ sudo ip link set dev eth0 down $ sudo ip link set dev eth0 address 00: 00: 00: 00: 01 $ sudo ip link set dev eth0 up
Method 2: macchanger

The macchanger command allows you to change the MAC address to the serial number of different manufacturers.

Install macchanger In Debian, Ubuntu, or Linux Mint:

$ sudo apt-get install macchanger

Install macchanger in Fedora:

$ sudo yum install macchanger

Install macchanger in CentOS or RHEL:

$ wget http://ftp.club.cc.cmu.edu/pub/gnu/macchanger/macchanger-1.6.0.tar.gz$ tar xvfvz macchanger-1.6.0.tar.gz$ cd macchanger-1.6.0 $ ./configure$ make$ sudo make install 

The following are some examples of advanced use of macchanger. You do not have to manually disable or enable your Nic when using macchanger.

Only change the MAC address:

$ sudo macchanger --mac=00:00:00:00:00:01 eth0

When the OUI is consistent, set a random address for MAC:

$ sudo macchanger -e eth0

Set a random address for MAC:

$ sudo macchanger -r eth0

Obtain the MAC addresses of all NICs and then only list the specified vendors (such as Juniper ):

$ macchanger -l | grep -i juniper

Display the original MAC address and disguised MAC address of a network adapter:

$ macchanger -s eth0Current MAC: 56:95:ac:ee:6e:77 (unknown) Permanent MAC: 00:0c:29:97:68:02 (Vmware, Inc.)
How can I change the MAC address permanently?

If you want to keep the MAC address disguised after the system restarts, You need to edit the configuration file. For example, if you want to change the MAC address of eth0, do the following:

Under Fedora, CentOS, or RHEL:
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0MACADDR=00:00:00:00:00:0

Alternatively, you can create a boot script in the/etc/NetworkManager/dispatcher. d directory, provided that you use Network Manager to manage your Network. Assume that you have installed macchanger. The script content is as follows:

$ sudo vi /etc/NetworkManager/dispatcher.d/000-changemac#!/bin/bash case "$2" in    up)        macchanger --mac=00:00:00:00:00:01 "$1"        ;;esac
$ sudo chmod 755 /etc/NetworkManager/dispatcher.d/000-changemac
In Debian, Ubuntu, or Linux Mint:

Create a new boot script under the/etc/network/if-up.d/directory:

$ sudo vi /etc/network/if-up.d/changemac #!/bin/sh if [ "$IFACE" = eth0 ]; then  ip link set dev "$IFACE" address 00:00:00:00:00:01fi
$ sudo chmod 755 /etc/network/if-up.d/changemac

The above two methods are introduced here. Thank you!

From: https://linux.cn/article-2793-1.html

Address: http://www.linuxprobe.com/linux-mac-address.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.