Fishwaldo / sophgo-sg200x-debian

Debian Image for SG200x based boards such as Milk Duo256/DuoS and Sipeed LicheeRVNano
81 stars 9 forks source link

Mac Address (via SSH) #12

Open isarrider opened 3 months ago

isarrider commented 3 months ago

Hi,

awesome project for this tiny thing...

My DuoS gets a new IP every time it boots... Does the MAC adress change randomly?

BR, Alex

Fishwaldo commented 3 months ago

Yes. I will post some instructions soon how to setup a static MAC address.

isarrider commented 3 months ago

Any idea why it doesnt use the burned in one?

Fishwaldo commented 3 months ago

There is no one default one.

The buildroot has some tricks to generate one on first boot and save it to the filesystem from memory (but that trick isn't compatible with Debian/Network Manager

isarrider commented 3 months ago

Hmm - interesting - in all my past there were always the MACs burned in...

Fishwaldo commented 3 months ago

It's an unfortunate trend that's becoming more prevalent.

(There maybe a serial number in the efuse of the SOC that could be used to generate a MAC address but unfortunately no documentation exists on what efuse are present... )

PJ5168 commented 3 months ago

Yuo can set fixed mac address to "end0" in /etc/network/interfaces

powo01 commented 2 months ago

you can set your own mac address via "nmtui" as a clone mac address

isarrider commented 2 weeks ago

which is the preferred way and how do I do that exactly?

qgp9 commented 2 weeks ago

Here is my script using nmcli. At least, it works for me.

https://gist.github.com/qgp9/0d77ce769c03e2d313d72fa1b6582555

#!/bin/sh
DEVICE=end0
MAC="26:6E:FE:5C:CE:38" # prefered mac address

UUID=$(nmcli -f UUID,DEVICE connection show | awk -v dev=$DEVICE '$2==dev{print $1}')
nmcli connection down $UUID
nmcli connection modify $UUID ethernet.cloned-mac-address "$MAC"
nmcli connection up $UUID

I recommend reusing a current Mac address, as a current ssh connection will be most likely alive with the same mac address and dhcp return value.

isarrider commented 2 weeks ago

Thanks... actually this MAC stuff annoys me a bit... Good old days where it was burnt in ;)