I know that I can change a network interface's MAC address by bringing the interface down, using a command like ifconfig eth0 hw ether 00:11:22:33:44:55
or ip link set eth0 address 00:11:22:33:44:55
and then bringing the interface up again. A command like ip link show eth0
then confirms that the change was successful.
But I recently discovered the files in /sys/class/net
(originally from this answer): each one is a symbolic link to a directory containing files with information about the interface as documented here For example, on my machine, the ethernet interface is enp3s0
(I have no idea why it has such a strange name), and /sys/class/net/enp3s0
links to /sys/devices/pci0000:00/0000:00:1c.2/0000:03:00.0/net/enp3s0
.
In this directory, I then found the file address
which is just a text file containing the MAC address of the interface. But when I attempt to change the address using one of the commands above, the address
file stays the same, so apparently, the commands do not change the MAC address on the lowest level. It is also not possible to change this file in any manner, not even the superuser has permission to do this.
So now, just out of curiosity: Is it possible to change the MAC address of a network interface on this level?