PINE64
Rock64: MAC Address is NOT Unique! - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Pine A64 Hardware, Accessories and POT (https://forum.pine64.org/forumdisplay.php?fid=32)
+---- Forum: Ethernet Port (https://forum.pine64.org/forumdisplay.php?fid=39)
+---- Thread: Rock64: MAC Address is NOT Unique! (/showthread.php?tid=12889)



Rock64: MAC Address is NOT Unique! - PDXpi - 01-24-2021

I have two Rock64 boards:
  • One is Version 2 (4GB).
  • One is Version 3 (4GB).
I've installed DietPi 6.34.3 on both boards. But I'm not able to connect both to the same broadcast domain at the same time because each has board has the same MAC address (86:e0:c0:ea:fa:a9)!

So I started digging around. And I found that...

I'm not able to find the first 3 octets (86:e0:c0) in any OUI databases. But the kernel ring buffer had these entries...

Code:
e1000e: Intel(R) PRO/1000 Network Driver
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
igb: Intel(R) Gigabit Ethernet Network Driver
igb: Copyright (c) 2007-2014 Intel Corporation.
igbvf: Intel(R) Gigabit Virtual Function Network Driver

...and...

Code:
RTL8211F Gigabit Ethernet stmmac-0:00: attached PHY driver [RTL8211F Gigabit Ethernet] (mii_bus:phy_addr=stmmac-0:00, irq=POLL)
RTL8211F Gigabit Ethernet stmmac-0:01: attached PHY driver [RTL8211F Gigabit Ethernet] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)

To state the obvious:
  • The first one appears to be related to an Intel PRO/1000 NIC.
  • The second one appears to be a Realtek RTL8211 NIC.
I've read a few of Mark's posts on the subject. And I know/believe that...

  1. When setting the MAC address: It should begin with 00:06:dc (i.e., The OUI of Syabas Technology [Amquest]). [ Reference ]
  2. The accepted solution is to specify the MAC address manually in /etc/uEnv.txt using the macaddr= and/or the eth_addr= settings. I may be wrong - But I believe that these settings are now located in /boot/armbianEnv.txt. [ Reference ]
But specifying either one or both has no affect on the MAC address (86:e0:c0:ea:fa:a9)! e.g., Neither setting appears in the Kernel command-line:


Code:
dietpi@DietPi:~$ grep addr  /boot/armbianEnv.txt
ethaddr=00:06:dc:00:00:01
mac_addr=00:06:dc:00:00:01

dietpi@DietPi:~$ ip add | grep ether | awk '{ print $2 }'
86:e0:c0:ea:fa:a9

dietpi@DietPi:~$ cat /proc/cmdline
root=UUID=1542112e-4bd9-4f4a-9660-e9405c792736 rootwait rootfstype=ext4  consoleblank=0 loglevel=4 ubootpart=72193746-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u 

dietpi@DietPi:~$ sudo dmesg | grep 'Kernel command line' | sed 's/\[.*\] //'
Kernel command line: root=UUID=1542112e-4bd9-4f4a-9660-e9405c792736 rootwait rootfstype=ext4  consoleblank=0 loglevel=4 ubootpart=72193746-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u

  1. Have I overlooked something besides the solution proposed on the Wiki page? i.e., WNpctool.exe
  2. Is there a solution for folks that don't have MS Windows in their environment? e.g., Linux "purists"
TIA!


RE: Rock64: MAC Address is NOT Unique! - as365n4 - 01-25-2021

You need to spoof the MAC address when you have more than one on your network.
It seems the MAC address is not physically burned onto a chip or something, but is created by the Operating System and changes with Linux flavour (Arch is different than Debian for instance)

create /etc/systemd/network/00-default.link like below
Code:
[Match]
MACAddress=da:19:c8:7a:6d:f4 <--- whatever your original address is

[Link]
MACAddress=da:19:c8:7a:6d:f5 <--- your desired address
NamePolicy=kernel database onboard slot path

This will overwrite the system settings at each boot and works fine on Arch and Debian.


RE: Rock64: MAC Address is NOT Unique! - PDXpi - 01-25-2021

(01-25-2021, 09:42 AM)as365n4 Wrote: create /etc/systemd/network/00-default.link like below
Code:
[Match]
MACAddress=da:19:c8:7a:6d:f4 <--- whatever your original address is

[Link]
MACAddress=da:19:c8:7a:6d:f5 <--- your desired address
NamePolicy=kernel database onboard slot path

This will overwrite the system settings at each boot and works fine on Arch and Debian.

FIRST: I removed the previous entries from /boot/armbianEnv.txt...

Code:
dietpi@DietPi:~$ cat /boot/armbianEnv.txt
verbosity=4
bootlogo=false
overlay_prefix=rockchip
rootdev=UUID=1542112e-4bd9-4f4a-9660-e9405c792736
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
docker_optimizations=off
console=none

SECOND: I created the /etc/systemd/network/00-default.link file and entered the five lines of configuration into it:

Code:
dietpi@DietPi:~$ ls -l /etc/systemd/network/
total 4
-rw-r--r-- 1 root root 118 Jan 25 16:26 00-default.link
lrwxrwxrwx 1 root root  9  Dec 16 07:48 99-default.link -> /dev/null

dietpi@DietPi:~$ cat /etc/systemd/network/00-default.link
[Match]
MACAddress=86:e0:c0:ea:fa:a9

[Link]
MACAddress=00:06:dc:00:00:01
NamePolicy=kernel database onboard slot path

THIRD: I rebooted the Rock64.

But the MAC address persists, unchanged:

Code:
dietpi@DietPi:~$ ip add | grep ether | awk '{ print $2 }'
86:e0:c0:ea:fa:a9

Is there something more that I need to do? e.g., Perhaps remove /etc/systemd/network/99-default.link?

TIA!


RE: Rock64: MAC Address is NOT Unique! - PDXpi - 02-01-2021

UPDATE

Over on the DietPi forum: Michalng provided a couple of feasible solutions to this. This is the one that I selected...

Code:
root@DietPi:~# mv /etc/udev/rules.d/80-net-setup-link.rules /tmp

root@DietPi:~# echo 'SUBSYSTEM=="net", KERNEL=="eth0", ACTION=="add", RUN+="ip l set dev eth0 address 00:06:dc:00:00:01"' > /etc/udev/rules.d/99-eth0-mac.rules

And it seems to have worked as expected:

Code:
root@DietPi:~# cat /etc/udev/rules.d/99-eth0-mac.rules
SUBSYSTEM=="net", KERNEL=="eth0", ACTION=="add", RUN+="ip l set dev eth0 address 00:06:dc:00:00:01"

root@DietPi:~# reboot

dietpi@DietPi:~$ ip address show eth0 | grep ether
    link/ether 00:06:dc:00:00:01 brd ff:ff:ff:ff:ff:ff

HTH somebody!