1

I'm trying to permanently modify my MAC address on a device running Linux 3.3.8 I cannot get macchanger to install either.

When I try it with

ifconfig eth0 hw ether [MAC_ADDRESS]

I get

ifconfig: SIOCSIFHWADDR: Device or resource busy

I have ssh'd into the device. The device is on wifi and ethernet. I've connected through wifi and trying to change the ethernet's mac address. I've tried

ifconfig eth0 down
ifconfig etho hw NEW_MAC
get the error: ifconfig: SIOCSIFHWADDR: Device or resource busy
ifconfig eth0 up

ifconfig shows the mac address was updated. However the GUI elements still show the old mac address. Also, the changes are lost after restart.

> uname -a 
> Linux (none) 3.3.8-4.2-g8c1f1dd #1 SMP Thu Jun 27 11:30:45 UTC 2019 mips GNU/Linux

1 Answer 1

2

The MAC address should be changed before the system brings up the network interface.

Bring down the interface to test: ip link set dev eth0 down, change the MAC address, then ip link set dev eth0 up. Verify that the change was carried out, for example by typing ip link.

You did not specify your flavor of Linux. Assuming you have a Debian-like system, to make the change permanent you can add a line in /etc/network/interfaces. Locate your eth0 stanza and use the hwaddress directive eg:

iface eth0 inet dhcp
    hwaddress ether xxxxxxxxx

where xxxxxxxxx represents your chosen address. If you prefer a random address then you can use macchanger and add a line in that same /etc/network/interfaces file:

iface eth0 inet dhcp
    pre-up macchanger -r eth0

If your network interface is managed by Network Manager, then you can randomize the MAC address for all interfaces or on a per-connection basis. have a look here for example or here. You can use the nmcli utility (or nmtui).

19
  • I added more information to my question. I don't have a folder named "network" in etc. Running ip link set dev eth0 down does not return an error but ifconfig shows the device is still up. Apr 16, 2020 at 2:09
  • I still don't know which flavor of Linux you are running (eg Debian) or the device ?... you've only mentioned the kernel, but I see a couple of possible issues. If you don't have /etc/network/interfaces that could be why ifconfig does not work for you. ip link set eth0 down/up should work as root even if your interface is not properly configured. If you are not root add sudo in front of your commands eg sudo ip link set eth0 down.To make changes permanent we need to know what network manager you use. What is the output of nmcli dev status, if that works for you ?
    – Kate
    Apr 16, 2020 at 21:01
  • nmcli command was not found. I am on a Mag322 IPTV box Apr 17, 2020 at 18:30
  • also, ip link set eth0 down did not work Apr 17, 2020 at 19:06
  • I did not realize you have an embedded device. It probably uses U-boot (a BIOS substitute). Perhaps you can set the MAC from there. Type sudo fw_printenv and see if 1) if that works for you and 2) you see something like eth1addr or ethaddr in the configuration. Then I would add a new setting like this: setenv eth1addr xx:xx:xx:xx:xx:xx, where xx:xx:xx:xx:xx:xx represents your chosen address. Assuming you have only one ethernet port I think it would be eth1addr but not sure. Ref: 14.2.13. Ethernet Does Not Work
    – Kate
    Apr 18, 2020 at 1:40

You must log in to answer this question.

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