How to Spoof a MAC Address in Linux

In some ethical hacking engagements, you might need to spoof the MAC address of a network interface card. This short list of steps help you do that:

1. Find the name of the interface you want to spoof the MAC of.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ifconfig
ifconfig
ifconfig

You’ll see interface names such as “eth0”, or “ens33”, depending on the Linux distro you’re using.

Note: If this command doesn’t exist, you can install the “net-tools” package through “apt”, “yum” or any other package manager you use.

2. Turn the interface off:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ifconfig ens33 down
ifconfig ens33 down
ifconfig ens33 down

Replace “ens33” with your interface name of choice.

3. Update the MAC address:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ifconfig ens33 hw ether 12:34:56:78:90:12
ifconfig ens33 hw ether 12:34:56:78:90:12
ifconfig ens33 hw ether 12:34:56:78:90:12

Replace the “12:34:56:78:90:12” with the MAC address of your choice.

4. Turn the interface on:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ifconfig ens33 up
ifconfig ens33 up
ifconfig ens33 up

That’s all!