Hi Everyone
How to create a fixed enc28j60 LAN eth0 MAC address?
I followed the Raspberry PI forum ticket #188009: https://forums.raspberrypi.com/viewtopic.php?t=188009
However, the Radxa Zero still generated a random mac address from each booting up.
// Custom MAC address service file
pi@radxa-zero:~$ cat /etc/systemd/system/custommac.service
[Unit]
Description=DSet the MAC address for the ENC28J60 enet adapter at eth0
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-eth0.device
After=sys-subsystem-net-devices-eth0.device
[Service]
Type=oneshot
ExecStart=/usr/bin/custommac.sh
ExecStart=/sbin/ip link set dev eth0 up
[Install]
WantedBy=multi-user.target
// Custom mac address bash file
pi@radxa-zero:~$ cat /usr/bin/custommac.sh
#!/bin/sh
sudo /sbin/ip link set dev eth0 address sed -n "s/0x..\(..\)\(..\)\(..\)/d4:9c:ac:\1:\2:\3/p" /sys/devices/platform/soc/ffe07000.mmc/mmc_host/mmc2/mmc2:0001/serial
Thanks in advance