0

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

  • try systemd-udevd – DDS Feb 14 '19 at 15:58
  • @DDS This facility is not available to me on this version of Linux. Version is Linux arria10 4.1.33-ltsi-altera #1 SMP Mon Oct 30 10:14:22 PDT 2017 armv7l GNU/Linux – Brian Waters Feb 14 '19 at 16:14
  • What about udev rules in /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:19
  • @eblock Is this a file I have to create myself? Do you have a template? – Brian Waters Feb 14 '19 at 16:35
  • 1
    The purported duplicate question is specific to Debian and Debian-derived operating systems. This question has not actually specified an operating system. (No, specifying the kernel is not enough.) – JdeBP Feb 14 '19 at 17:40
  • From my example (a openSUSE VM) it's a rule created by udev: rpm -qf /usr/lib/udev/write_net_rules udev-228-150.58.1.x86_64

    The rule looks like this: SUBSYSTEM=="net", ACTION=="add", DRIVERS=="virtio-pci", ATTR{dev_id}=="0x0", KERNELS=="0000:00:03.0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    – eblock Feb 18 '19 at 08:49

1 Answers1

0

Don't have an angstrom box at reach, but IIRC you can set this in the /etc/network/interfaces file

auto eth1
iface eth1 inet dhcp # or whatever setting you need for eth1
hwaddress ether 00:11:22:33:44:56