• caglararli@hotmail.com
  • 05386281520

Spoofing MAC address not working with wired interface

Çağlar Arlı      -    4 Views

Spoofing MAC address not working with wired interface

I run the following script at boot to spoof my mac address before starting NetworkManager and connecting to any AP:

#!/bin/bash

# Wireless mac spoofing
echo "Spoofing wireless mac address (wlan0)"
sudo ifconfig wlan0 down
sleep 2
sudo macchanger -r wlan0
sleep 2
sudo ifconfig wlan0 up
sleep 2

# Connecting
echo "Starting NetworkManager..."
sudo systemctl start NetworkManager
sleep 10
sudo systemctl restart NetworkManager # Required for some reason

It works perfectly fine with my wireless interface (wlan0) and I can access internet with the new MAC address.

However, this doesn't work with my wired interface (eth0). My MAC is changed without problems but I'm unable to connect to internet. It's stuck at trying to get an IP. I've tried getting a new DHCP lease without success.