Persistent MAC address in ubuntu image

I have been able to download the 64M ubuntu image from Spiritdude and run it on the duo 64. But, every time I reboot the machine it has another random MAC address.

Has anyone managed to set a persistent MAC address with this image?
I have tried a few things but they have all been fails.

1 Like

I’m afraid it is in the C code by design. But yes, you can circumvent that, like done here with the original development environment.

Update:

I copied the file /etc/systemd/system/rndis.service to create a /etc/systemd/system/eth.service and modified it accordingly.

I then created an /etc/eth-set.sh file that I based on the /etc/usb-rndis.sh file that is called by is called by rndis.service. eth-set.sh is called by eth.service. In eth-set.sh, I use “ip” to set eth0 down and then set the MAC address before setting eth0 up again.

I don’t know how secure this code is but it now seems to reassign the MAC address on boot up so that my router can assign a specific IP to this board.

1 Like

With all images I’ve used I have been able to set ethaddr in u-boot. Could you try that and advise?

1 Like

I have seen your solution to a previous post - Jan 8 - but as I am not actually compiling the image myself, I am using an image compiled by Spiritdude that uses ubuntu, I didn’t think that changing u-boot config files would do anything in this case.

When I find the time to learn how to compile for ubuntu for myself, I will definitely use your solution. I have compiled a few buildroot images myself but haven’t tried to compile ubuntu/alpine/debian yet.

In the meantime, apt works - even if slow - and gcc compiles my c-code and the little board runs the resulting programs surprisingly fast.

This method doesn’t require recompiling U-Boot at all. Have you tried it?
Requires connecting to the board while it is still in the U-Boot stage, therefore you will need UART like here.

I haven’t tried this method yet. I don’t have a USB-to-TTL cable yet.

I might make myself one on the weekend and try it.

1 Like