Jump to content
  • 0

Changing MAC address for RockpiS - 21.08.2 Focal / Linux 5.14.5-rockchip64


rossyduck
 Share

Question

Using the 5.xx kernal I have been changing the eth0 MAC address at  /etc/NetworkManager/system-connections/  'Wired connection 1.nmconnection'.  This has changed a bit as the versions progress - but version  Armbian 21.08.2 Focal / Linux 5.14.5-rockchip64 has now moved the "wired ..." file to the /run/NetworkManager/system-connections/ and suspect the file is recreated at every boot (edits do not stick).  I have tried to set MAC  at /boot/armbianEnv.txt and in the eth config file.  None work.  Any ideas as to how to set the MAC address - and is it now even possible?.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Order Armbian Linux merch!

  • 0
On 9/21/2021 at 12:02 AM, rossyduck said:

5.14.5-rockchip64

 

6 hours ago, rossyduck said:

Still no fix for this.  Holding back our project.

For that reason (edge kernel) and missing logs your issue report was invalid anyways so you are lucky that someone answered.

Link to comment
Share on other sites

  • 0

I ran into the same issue...  This might be a fix...

A udev script assigns an Ethernet address derived from the UUID of the root partition.
So, each machine's WiFi should be unique and unchanging -- until its root partition is reformatted.

 

Note that that ‘42’ argument in macaddr.rules should be unique to each network interface whose Ethernet address is being assigned this way.

Further, this prefix less 2 should be exactly divisible by 4


/etc/udev/rules.d/05-wlan0-macaddr.rules:
 

KERNEL==“wlan0”, ACTION==“add” RUN+=“fixEtherAddr %k 42”


/lib/udev/fixEtherAddr:

#!/bin/sh
#Assign specified interface a fixed, unique Ethernet MAC address constructed
#as given prefix byte followed by 1st five bytes of the root partition’s UUID.
#Ethernet prefix byte value less 2 should be exactly divisible by 4
#e.g. (prefix - 2) % 4 == 0

[ “$2” ] || {
echo “Specify network interface and first Ethernet address byte in hex” >&2
exit 1
}

ethaddr() {
echo -n “$1”
/bin/lsblk -no UUID /bin/findmnt -no SOURCE / |
/bin/tr -d ‘-’ | /bin/fold -b2 |
for byte in 1 2 3 4 5; do read hex; echo -n “:$hex”; done
}

/usr/sbin/ifconfig $1 hw ether ethaddr $2

This file must be made executable (chmod +x /lib/udev/fixEtherAddr)

 

reboot and you should see the wlan0 interface's Ethernet address like this:

brent@pebble:/etc/udev/rules.d$ /sbin/ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

...
        ether 42:bb:a9:cc:8a:e9  txqueuelen 1000  (Ethernet)

 

brent@pebble:/etc/udev/rules.d$ /sbin/blkid

/dev/mmcblk0p1: UUID="bba9cc8a-e9bb-499a-a089-e5394b7a4fde"

 

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...