Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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?.

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"

 

 

 

 

I use a single master image to build all my machines, so the root partition UUID is identical for all instances.

@brentr, do you have a magical script for this? I guess I could just create a random MAC and save it to disk somewhere...

Interestingly, Armbian seems to include logic to generate a random mac: function set_fixed_mac() in https://github.com/armbian/build/blob/f90bd10622b9e526be9fc4e6fe5cdcf56b529e52/packages/bsp/common/usr/lib/armbian/armbian-common#L35

Any ideas why it doesn't work?

I'm running a Rock Pi S, and here are my logs: https://paste.armbian.com/efayiretiy
 

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
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.