Wednesday, July 3, 2024
HomeOperating SystemsDebianHow to Change Your MAC address in Kali Linux and Linux

How to Change Your MAC address in Kali Linux and Linux

There are situations that you must change or spoof your MAC address of your Network Interface Card.The reasons for Changing can be controversial. For example,when performing some authorised security audits, it may be necessary to  change your MAC address while MAC filtering  is ON. Also, an attacker may have gained access to your machine illegally and wants to leave no trace of his activity and what he will do is use a fake MAC address when attacking your system so that you cannot trace him/her back. To Mitigate MAC spoofing techniques, you have to know how to spoof it yourself. Lets get started.

Mac address

We will consider two situations; changing your MAC address temporarily and Making the address permanent. For this Tutorial we’ll use Kali Linux, which by default comes with macchanger.

Change MAC Address on Linux using macchanger

Macchanger  is a Linux utility for viewing/manipulating the MAC address for network interfaces. If you are running a different distribution Of Linux, you may have to install macchanger, you will need superuser privileges to install it using sudo command.

How to install macchanger in Debian based distributions and Ubuntu

sudo apt update
sudo apt install macchanger

During installation you can choose to automatically change MAC address on your system.

change mac address linux kali 01

How to install macchanger in Redhat, Fedora, Centos, RHEL

sudo yum install macchanger

For usage option run the command below:

$ macchanger --help

Standard options available are:

  • -h, –help: Show summary of options.
  • -m, –mac=XX:XX:XX:XX:XX:XX: Set the MAC address to XX:XX:XX:XX:XX:XX
  • V, –version: Show version of program.
  • e, –ending: Don’t change the vendor bytes.
  • -a, –another: Set random vendor MAC of the same kind.
  • -A: Set random vendor MAC of any kind.
  • r, –random: Set fully random MAC.
  • -p, –permanent : Reset MAC address to its original, permanent hardware value.
  • -l, –list[=keyword] : Print known vendors (with keyword in  the  vendor’s  description

To change MAC address with Macchanger type:

sudo macchanger --mac=XX:XX:XX:XX:XX:XX
#OR:
sudo macchanger -m=XX:XX:XX:XX:XX:XX

Replace XX:XX:XX:XX:XX:XX with your desired spoofed MAC address.

Change MAC Address on Linux using ifconfig

To change your MAC address without the macchanger program using ifconfig command. Follow the steps below

1. Take a note of your original MAC address

mac change1

2. Take the interface you wanna change the MAC address down

  • sudo ifdown eth0 for ethernet 0 interface and
  • sudo ifdown wlan0 for wireless interface.

3. Next step is to configure new MAC address, this will be temporary and will be lost when you restart your machine.

sudo ifconfig eth0 hw ether 11:22:03:02:ab:bb
sudo ifconfig wlan0 hw ether 11:22:03:02:ab:bb

My new MAC will be 11:22:03:02:ab:bb. Rem it is hexadecimal 48 bits long.

4. Return your interface up

To bring eth0 interface up type:

sudo ifup eth0

To bring wlan0 interface up type the following command.

sudo ifup wlan0 

To make a spoofed MAC address permanent,open interfaces file

 sudo vi /etc/network/interfaces

For RedHat based distros it will be located in /etc/sysconfig/network-scripts directory.

Add the following line.

For eth0 interface, add:

pre-up ifconfig eth0 hw ether 11:22:03:02:ab:bb 

For wlan0 interce add:

pre-up ifconfig wlan0 hw ether 11:22:03:02:ab:bb

Save the changes and quit, then restart your Network Interface.

Nicole Veronica Rubhabha
Nicole Veronica Rubhabha
A highly competent and organized individual DotNet developer with a track record of architecting and developing web client-server applications. Recognized as a personable, dedicated performer who demonstrates innovation, communication, and teamwork to ensure quality and timely project completion. Expertise in C#, ASP.Net, MVC, LINQ, EF 6, Web Services, SQL Server, MySql, Web development,
RELATED ARTICLES

Most Popular

Recent Comments