5

Sometimes I need to spoof MAC address, I'm doing so with this command:

ip link set dev eth0 address XX:XX:XX:XX:XX:XX

Is there a way how to set MAC address back to default without reboot?

3 Answers 3

5

See also:

sudo ethtool -P eth0

So, to set the MAC address back to its default (assuming GNU grep here):

set_to_real() (
  for i do
    mac=$(ethtool -P "$i" | grep -iEom1 '([0-9a-f]{2}:){5}[0-9a-f]{2}') &&
      ip link set dev "$i" address "$mac"
  done
)
set_real eth0
0
2

Your "real MAC" might be reported by the kernel on boot, so have a look at

dmesg | grep eth0

and try using your ip link set... with the MAC you find there.

1
  • Well, I was looking for something else (like eth0 address "set-to-real") but this is also a solution, thanks! :-)
    – Micer
    Commented Nov 28, 2012 at 13:45
2

There is a macchanger tool which allows to do it. From man macchanger:

macchanger [options] device
 -p, --permanent
     Reset MAC address to its original, permanent hardware value.

So assuming your interface is eth0, you run:
# macchanger -p eth0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .