Change your MAC address - Anonymity


Anonymity is one of the most important elements for the penetration tester (hacker).

In this guide, you will learn how to change your MAC address.

what is a MAC address?

From Wiki,

A media access control address (MAC address) is a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment.

So why is it important to change it?

Since it's a unique identifier that can leave a trail back to you.

So let's get started.

Power up your Kali machine

open up a terminal window and run:

ifconfig | grep ether

you can use this as well:

ip link show | grep ether

ifconfig = stands for "interface configuration." It is used to view and change the configuration of the network interfaces on your system.

grep = searches the input files for lines containing a match to a given pattern list. When it finds a match in a line, it copies the line to standard output (by default).

This is what you will get:

ifconfig-change your MAC

There are two ways to change your MAC address:

  1. With a software

  2. With the help of a set of commands

let's start with the software:

In Debian system bases like Ubuntu and Kali, You will install the software named MacChanger:

# sudo apt install macchanger -y

During installation, a pop up question will appear, asking whether to automatically make the change to any network card that is detected.

My recommendation - do not confirm, check No:

Change you MAC - macchanger

Once the installation is complete, you can change the MAC address in one of two ways:

  1. Automatic

  2. Manual


Automatic:

In order for the software to generate a new MAC, run the following command:

# sudo ifconfig {interface name} down

# sudo macchanger -r {interface name}

If I'll run it on my machine for the Wi-Fi card, named wlan1, it will look like that:

# sudo macchanger -r wlan1


Don't forget to active the interface back:

# sudo ifconfig {interface name} up

and that is it.


Manual:

Changing the MAC manually in the terminal;

# sudo ip link set dev {interface name} down

# sudo ip link set dev {interface name} address XX:XX:XX:XX:XX:XX

# sudo ip link set dev {interface name} up

once you are done, you will check your new MAC address,

# ip link show {interface name}


change your mac

If you would like to make the change permanent and keep a specific MAC every time you boot up your Kali machine, you will need to change the interfaces file.

Kali Linux was built based on Debian. In Debian all the network interface are located on /etc/network/interfaces

This is how you will do so:

In this tutorial, I'm using "nano" text editor, but you can choose any of your favorite text editor.

# nano /etc/network/interfaces

Now you will add one line of script to change your MAC address permanently:

pre-up ifconfig eth0 hw ether 00:11:22:33:44:55

This script will load on system startup.

If you want to restore the default MAC address, just add the # sign in front of script:

#pre-up ifconfig eth0 hw ether 00:11:22:33:44:55

All the guides, tips, and tricks on this web site are for education purpose only, the website owner is not accountable for any use of this information