I need to alter the MAC address for eth1 ethernet device on my embedded system permanently so it retains this MAC address on every boot.
The OS I'm using:
VERSION_ID="v2015.12"
NAME="Angstrom"
ID="angstrom"
PRETTY_NAME="The Ångström Distribution v2015.12"
ANSI_COLOR="1;35"
HOME_URL="http://www.angstrom-distribution.org"
The version of Linux I am using is:
Linux arria10 4.1.33-ltsi-altera #1 SMP Mon Oct 30 10:14:22 PDT 2017 armv7l GNU/Linux
I am able to set the MAC address for eth0 by altering the following bootarg:
setenv ethaddr 00:11:22:33:44:55
save
run bootcmd
Once booted, eth0 takes this MAC address as expected.
When I try to do the same for eth1, using eth1addr
a random MAC address is defined when I boot.
I can however alter the MAC address of eth1 once booted by using the following:
ifconfig eth1 down
ifconfig eth1 hw ether 00:11:22:33:44:56
ifconfig eth1 up
This is not a permanent solution for me as I would need to set the MAC every time I have booted the device.
Is there a way to set the MAC address of eth1 from the bootargs? Also any ideas on why I wouldn't be able to set the MAC address using setenv eth1addr
?
Edit:
eth0 is RGMII, eth1 is SGMII
systemd-udevd
– DDS Feb 14 '19 at 15:58/etc/udev/rules.d/70-persistent-net.rules
or is this also not possible due to the previous comment? – eblock Feb 14 '19 at 16:19rpm -qf /usr/lib/udev/write_net_rules udev-228-150.58.1.x86_64
The rule looks like this:
– eblock Feb 18 '19 at 08:49SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"