TonyB.ca Posted May 28, 2023 Posted May 28, 2023 (edited) Greetings, I have multiple NanoPi NEO3s on the same subnet. When booting with Ubuntu 20.04.6 LTS they use the physical MAC address when posting to DHCP, but ARMbian seems to create a default (fake) MAC address and uses that instead. Judging by the "armbianmonitor -U" output, ARMbian knows about the physical MAC address, it just doesn't use it. The NEO3 board is listed as supported, but there is another posting dated 2020 that still seems to be unresolved. MAC address c2:1f:b3:b0:d2:41 seems to be a generic (fake) address that is being used. Is there a remedy to allow it to use the actual hardware address with this kernel ? -- -- -- bracka@NanoPi-neo3:~$ hostnamectl Static hostname: NanoPi-neo3 Icon name: computer Machine ID: 7a8f8d11a2be4919bc15a3b60d4bb717 Boot ID: af467481c9054525b978b6a316e61c94 Operating System: Debian GNU/Linux 11 (bullseye) Kernel: Linux 6.1.11-rockchip64 Architecture: arm64 bracka@NanoPi-neo3:~$ sudo ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.196 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::6cf0:52e7:7e44:23f8 prefixlen 64 scopeid 0x20<link> ether c2:1f:b3:b0:d2:41 txqueuelen 1000 (Ethernet) RX packets 1032591 bytes 1165880161 (1.0 GiB) RX errors 0 dropped 471 overruns 0 frame 0 TX packets 303323 bytes 43670515 (41.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 51 $ armbianmonitor -U 8 Thu 25 May 2023 09:48:33 PM UTC | NanoPi Neo 3 | 23.02.2 | arm64 | aarch64 | 6.1.11-rockchip64 730 ### ip addr: 731 732 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 733 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 734 inet XXX.XXX.0.1/8 scope host lo 735 valid_lft forever preferred_lft forever 736 inet6 ::1/128 scope host 737 valid_lft forever preferred_lft forever 738 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 739 link/ether 9a:84:df:28:e1:3e brd ff:ff:ff:ff:ff:ff 1316 ### armbian-release: 1317 1318 # PLEASE DO NOT EDIT THIS FILE 1319 BOARD=nanopineo3 1320 BOARD_NAME="NanoPi Neo 3" 1321 BOARDFAMILY=rockchip64 1322 BUILD_REPOSITORY_URL=https://github.com/armbian/build 1323 BUILD_REPOSITORY_COMMIT=1a8daf0 1324 VERSION=23.02.2 1325 LINUXFAMILY=rockchip64 1326 ARCH=arm64 1327 IMAGE_TYPE=stable 1328 BOARD_TYPE=conf 1329 INITRD_ARCH=arm64 1330 KERNEL_IMAGE_TYPE=stable 1331 BRANCH=edge 1525 ### ip addr: 1526 1527 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 1528 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 1529 inet XXX.XXX.0.1/8 scope host lo 1530 valid_lft forever preferred_lft forever 1531 inet6 ::1/128 scope host 1532 valid_lft forever preferred_lft forever 1533 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 1534 link/ether c2:1f:b3:b0:d2:41 brd ff:ff:ff:ff:ff:ff * I am willing to research this if somebody can provide build & submission guidelines. Edited May 28, 2023 by TonyB.ca grammar fixes 0 Quote
TonyB.ca Posted May 29, 2023 Author Posted May 29, 2023 (edited) Further comment: I built the latest "bookworm/edge" image and it has the same problem. Can anybody point me at which modules set this or give me ideas as to how to locate it and I'll try my hand at correcting it? (... or try finding what Ubuntu did to fix it) bracka@nanopi-neo3:~$ hostnamectl Static hostname: nanopi-neo3 Icon name: computer Machine ID: e0dd9ba08bec458e97d14aa2a8797a5e Boot ID: 04b5eb118e9b4fb8a876b4ed81342106 Operating System: Armbian 23.08.0-trunk bookworm Kernel: Linux 6.3.4-rockchip64 Architecture: arm64 bracka@nanopi-neo3:~$ sudo ifconfig -a end0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.196 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::dc32:47a9:6da5:4074 prefixlen 64 scopeid 0x20<link> ether c2:1f:b3:b0:d2:41 txqueuelen 1000 (Ethernet) RX packets 645931 bytes 759294079 (724.1 MiB) RX errors 0 dropped 148 overruns 0 frame 0 TX packets 144665 bytes 89492195 (85.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 51 . . . I have also built the latest "jammy" release and it has the same issue: Welcome to Armbian 23.02.2 Jammy with bleeding edge Linux 6.1.11-rockchip64 bracka@nanopi-neo3:~$ hostnamectl Static hostname: nanopi-neo3 Icon name: computer Machine ID: 419c0895553e4efe9795e6f0899a794e Boot ID: 89aff8b2899c43d0aa16b0c245556b4d Operating System: Ubuntu 22.04.2 LTS Kernel: Linux 6.1.11-rockchip64 Architecture: arm64 bracka@nanopi-neo3:~$ ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.196 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::350b:a860:b0a1:80b9 prefixlen 64 scopeid 0x20<link> ether c2:1f:b3:b0:d2:41 txqueuelen 1000 (Ethernet) RX packets 109 bytes 11465 (11.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 91 bytes 11480 (11.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 51 -- -- -- So far, this release from the "Friendly" site does pick up the hardware MAC and use it. Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.78 aarch64) bracka@NanoPi-NEO3-2:~$ hostnamectl Static hostname: NanoPi-NEO3-2 Icon name: computer Machine ID: 493a472b58ef4baeaa0a4962766bd9a6 Boot ID: cf237517e7ad4aa7a89a18a30972b560 Operating System: Ubuntu 20.04.6 LTS Kernel: Linux 5.15.78 Architecture: arm64 bracka@NanoPi-NEO3-2:~$ ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.197 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::8234:28ff:fe79:2031 prefixlen 64 scopeid 0x20<link> ether 80:34:28:79:20:31 txqueuelen 1000 (Ethernet) RX packets 1137985 bytes 1275043076 (1.2 GB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 118723 bytes 22628010 (22.6 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 37 Regards, Tony Edited May 30, 2023 by TonyB.ca added a few more builds/tests 0 Quote
NaK Posted May 30, 2023 Posted May 30, 2023 I have a somewhat related issue running Rock Pi S: https://forum.armbian.com/topic/18977-changing-mac-address-for-rockpis-21082-focal-linux-5145-rockchip64/ In my case all machines have the same MAC address, but I'm still interested to see what you learn? 1 Quote
KaoDome Posted June 17, 2023 Posted June 17, 2023 Hi @TonyB.ca, I have another NanoPi Neo3 and I'm experiencing the same you are, I wonder what could be happening. Right now, I have a stable build on Jammy, but I have another microSD with which I'm making tests to try to see how come the actual MAC from the device isn't picked up. Just now I finished building a current Bookworm based Armbian, but with u-boot being that of 2023.04 instead, same outcome. I know the board was released with u-boot 2017.sth, but I thought, what the hell, perhaps it's a bug in the 2022 versions. In any case, I'm at a loss, I'll try to find other boards that ship with real MACs and see if there's any difference on how they're defined in configuration files or kernel builds. For example, the NanoPi R4S used to ship with a unique MAC, but due to shortage of parts or something they can't guarantee that now unless you place a considerable order; that doesn't happen with the Neo3, even if ordered just one they do come with a unique address. If anyone comes across this thread and knows at least where we should look into, we'd appreciate it! I'm new to this kind of low level stuff. 1 Quote
TonyB.ca Posted June 18, 2023 Author Posted June 18, 2023 Hi KaoDome, I downloaded the minimal release from FriendlyElec and it picks up the physical MAC address just fine. I have built a few minimal release images, but have not had a chance yet to test them out since some morons hacked by test lab and decided to encrypt/ransom my NAS and a bunch of dev VMware servers. So much for easy passwords in a test lab (lesson learned) ... no big deal as all the data is either trash or replaceable, and it was due for a redesign anyway. The FriendlyElec build is older, but uses the correct MAC address. I will post details once my network is fully back on line. If you look at my post, I explain what I am seeing. If we can determine where to look, I am certain that the change is obvious as these are both Debian/Ubuntu releases. 0 Quote
Kazymir Posted June 21, 2023 Posted June 21, 2023 I am allright with you and i find my MAC Address here sudo i2cdump 0 0x51 i have a Neo3 with i2c eeprom and the mac is writing inside and when i go to /etc/NetworkManager/system-connections# sudo nano Wired\ connection\ 1.nmconnection i can see that the MAC is fixed How can we patch this problem? 1 Quote
TonyB.ca Posted June 21, 2023 Author Posted June 21, 2023 Hi All, Again, the running operating system even reports back the physical MAC address. Something is overriding it, but finding out what and where is the challenge. My guess is that it is common code that is shared with the NEOs and possibly NEO2s which do not have a hard MAC address. These are line numbers from the same output. The FriendlyElec build of the same kernel does not have this problem. Maybe we need to look into armbianmonitor to find out the difference between the 2 sections of output as a potential starting point? This is a single output produced by running this program, and seems to be reporting the same interface, so SOMETHING already knows the physical MAC address. From my initial post: $ armbianmonitor -U ... 730 ### ip addr: 731 732 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 733 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 734 inet XXX.XXX.0.1/8 scope host lo 735 valid_lft forever preferred_lft forever 736 inet6 ::1/128 scope host 737 valid_lft forever preferred_lft forever 738 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 739 link/ether 9a:84:df:28:e1:3e brd ff:ff:ff:ff:ff:ff ... 1525 ### ip addr: 1526 1527 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 1528 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 1529 inet XXX.XXX.0.1/8 scope host lo 1530 valid_lft forever preferred_lft forever 1531 inet6 ::1/128 scope host 1532 valid_lft forever preferred_lft forever 1533 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 1534 link/ether c2:1f:b3:b0:d2:41 brd ff:ff:ff:ff:ff:ff 0 Quote
Kazymir Posted June 27, 2023 Posted June 27, 2023 si it can help you for a nanopi neo3 you can write a script like sudo nano extract_mac.sh #!/bin/bash # Extraire l'adresse MAC de l'EEPROM mac_address="" mac_address+="$(sudo i2cget -y -f 0 0x51 0xfa c):$(sudo i2cget -y -f 0 0x51 0xfb c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfc c):$(sudo i2cget -y -f 0 0x51 0xfd c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfe c):$(sudo i2cget -y -f 0 0x51 0xff c)" # Supprimer les préfixes "0x" mac_address="${mac_address//0x/}" mac_address=$(echo $mac_address | tr '[:lower:]' '[:upper:]') echo "MAC address: $mac_address" # Extraire l'adresse MAC du fichier de configuration NetworkManager configured_mac_address="$(sudo grep "mac-address=" /etc/NetworkManager/system-connections/Wired\ connection\ 1.nmconnection | cut -d "=" -f 2)" # configured_mac_address="${configured_mac_address//:/}" echo "configured mac address: $configured_mac_address" # Comparer les adresses MAC if [[ "$mac_address" != "$configured_mac_address" ]]; then echo "Les adresses MAC sont différentes. Mise à jour nécessaire." # Mettre à jour le fichier de configuration NetworkManager avec la nouvelle adresse MAC sudo sed -i "s/mac-address=.*/mac-address=$mac_address/" /etc/NetworkManager/system-connections/Wired\ connection\ 1.nmconnection # Redémarrer NetworkManager pour prendre en compte les modifications sudo service NetworkManager restart echo "Adresse MAC mise à jour et redémarrage du systeme." # Redémarrer complètement le système pour prendre en compte les modifications sudo reboot else echo "Les adresses MAC sont identiques." fi and Quote sudo chmod +x extract_mac.sh and to start script Quote ./extract_mac.sh it's working well for me best regards 2 Quote
Lollifeet Posted June 27, 2023 Posted June 27, 2023 this is very coded with foot, but its working thanx you 1 Quote
TonyB.ca Posted June 27, 2023 Author Posted June 27, 2023 Greetings All, If I run one of the Friendly distributions, they use the correct (physical) MAC address. My 3 are as follows: 80:34:28:79:4e:5c 80:34:28:79:2e:07 80:34:28:79:20:31 From this we can tell that FriendlyElec uses "80:34:28" as their vendor code. The remaining 3 digits compose the individual NIC address. Thanks for providing the script to work around the issue. It does what it needs to do, but it still raises the question as to why this is necessary. The FriendlyElec build does not require that we do this, so it would be great to have a base code fix. At some point I will try simply deleting the directory containing the script to see what happens ( - unless somebody else gets there first - 🙂 - ). For now, this script does what is needed ... bracka@NanoPi-NEO3b:/etc/NetworkManager/system-connections$ hostnamectl Static hostname: NanoPi-NEO3b Icon name: computer Machine ID: f86b967515a04b7aa4ee086b7ee8f50b Boot ID: 7d724c0ff2a544f7959641728cacfe16 Operating System: Ubuntu 20.04.6 LTS Kernel: Linux 5.15.78 Architecture: arm64 bracka@NanoPi-NEO3b:/etc/NetworkManager/system-connections$ ls -al total 8 drwxr-xr-x 2 root root 4096 Nov 26 2021 . drwxr-xr-x 7 root root 4096 Jun 13 20:55 .. Regards & Thank You, Tony 1 Quote
Kazymir Posted June 28, 2023 Posted June 28, 2023 yes i think they didn't read the i2c eeprom at start 1 Quote
Lollifeet Posted June 28, 2023 Posted June 28, 2023 You forgot something that i test, you can launch it directly. You just need to add this in the repository /etc/rc.local before the line "exit 0" /bin/bash /etc/init.d/extract_mac.sh If you do this, the script will launch automatically if the MAC didn't correspond, and if they correspond then he will don't reboot so you don't have to launch it manually if you had these line. 1 Quote
Kazymir Posted October 30, 2023 Posted October 30, 2023 (edited) so on the last revision i use another methode Create file in /etc/systemd/network sudo nano 99-default.link Quote [Match] OriginalName=* [Link] NamePolicy= Name=end0 MACAddressPolicy=none MACAddress=00:42:c4:9e:de:90 and reboot so the script change as Quote #!/bin/bash # Extraire l'adresse MAC de l'EEPROM mac_address="" mac_address+="$(sudo i2cget -y -f 0 0x51 0xfa c):$(sudo i2cget -y -f 0 0x51 0xfb c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfc c):$(sudo i2cget -y -f 0 0x51 0xfd c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfe c):$(sudo i2cget -y -f 0 0x51 0xff c)" # Supprimer les préfixes "0x" mac_address="${mac_address//0x/}" mac_address=$(echo $mac_address | tr '[:lower:]' '[:upper:]') echo "MAC address: $mac_address" # Extraire l'adresse MAC du fichier de configuration NetworkManager configured_mac_address="$(sudo grep "MACAddress=" /etc/systemd/network/99-default.link | cut -d "=" -f 2)" # configured_mac_address="${configured_mac_address//:/}" echo "configured mac address: $configured_mac_address" # Comparer les adresses MAC if [[ "$mac_address" != "$configured_mac_address" ]]; then echo "Les adresses MAC sont différentes. Mise à jour nécessaire." # Mettre à jour le fichier de configuration NetworkManager avec la nouvelle adresse MAC sudo sed -i "s/MACAddress=.*/MACAddress=$mac_address/" /etc/systemd/network/99-default.link # Redémarrer NetworkManager pour prendre en compte les modifications sudo service NetworkManager restart echo "Adresse MAC mise à jour et redémarrage du systeme." # Redémarrer complètement le système pour prendre en compte les modifications #sudo reboot else echo "Les adresses MAC sont identiques." fi Edited October 30, 2023 by Kazymir add informations 0 Quote
Kazymir Posted October 30, 2023 Posted October 30, 2023 step by step I am on Arbian 23.8.1 BookWorm linux 6.1.50 on my nanopi neo3 Create file with sudo nano /etc/systemd/network/99-default.link [Match] OriginalName=* [Link] NamePolicy= Name=end0 MACAddressPolicy=none MACAddress=00:42:c4:9e:de:90 i know it' a fake mac address for the start if you write sudo i2cdump 0 0x51 you have your real mac address so we need to write a script sudo nano /etc/init.d/extract_mac.sh #!/bin/bash # Extract MACAdress from i2c EEPROM mac_address="" mac_address+="$(sudo i2cget -y -f 0 0x51 0xfa c):$(sudo i2cget -y -f 0 0x51 0xfb c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfc c):$(sudo i2cget -y -f 0 0x51 0xfd c)" mac_address+=:"$(sudo i2cget -y -f 0 0x51 0xfe c):$(sudo i2cget -y -f 0 0x51 0xff c)" # remove "0x" mac_address="${mac_address//0x/}" mac_address=$(echo $mac_address | tr '[:lower:]' '[:upper:]') echo "MAC address: $mac_address" # Extraire l'adresse MAC du fichier de configuration NetworkManager configured_mac_address="$(sudo grep "MACAddress=" /etc/systemd/network/99-default.link | cut -d "=" -f 2)" # configured_mac_address="${configured_mac_address//:/}" echo "configured mac address: $configured_mac_address" # Comparer les adresses MAC if [[ "$mac_address" != "$configured_mac_address" ]]; then echo "WRONG Mac Address, rewrite good one" # Mettre à jour le fichier de configuration NetworkManager avec la nouvelle adresse MAC sudo sed -i "s/MACAddress=.*/MACAddress=$mac_address/" /etc/systemd/network/99-default.link sudo service NetworkManager restart echo "MAC Adress allright. Reboot" sudo reboot else echo "Mac Adress is already OK" fi If you want to test go in folder cd /etc/init.d sudo chmod +x extract_mac.sh ./extract_mac.sh to run automatic at boot open rc.local : sudo nano /etc/rc.local inside add /bin/bash /etc/init.d/extract_mac.sh before "exit 0" and reboot the good mac adress will be writting and use 0 Quote
Recommended Posts
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.