I am working on a platform with an ARM CPU running linux that has a single MAC in the CPU directly connected to a switch IC. I am trying to set up a VLAN mode using systemd-networkd which I have done successfully. However, the MAC addresses for the created VLAN ports are random and that is not ideal. Using MACAddressPolicy=persist in the relevant .link file I do have a persistent MAC address though each boot however the MAC address it grabbed was random.

However, the CPU is assigned two MAC addresses. What I am looking to do is find the first MAC address it is assigned (which is set to the eth0 device), assign that MAC to eth0.1, and then assign that MAC +1 to eth0.2 Is there an easy way to do this through systemd-networkd or udev? I also need a setup that can be put on to thousands of the completed devices and have systemd-netorkd automatically handle everything, rather than modifying the .network files on each unit.

  • Lamobo, Turris Omnia or Clear Fog? Lamobo R1 here. I would prefer doing it in udev. Maybe a script at installation time or first run? – Rui F Ribeiro Nov 17 '15 at 21:28
  • have a look at this: linux-sunxi.org/Ethernet – Rui F Ribeiro Nov 17 '15 at 21:43
  • @RuiFRibeiro None of the above, its a custom solution. The link you posted only covers passing the MAC address to the main ethernet port. This is already done and good to go (In my case the driver pulls it from a ROM). The problem is when VLANs are spawned, I need a way to pull in the eth0 MAC address, and then assign it to eth0.1, and assign +1 to eth0.2 VLAN ports. I'm not terribly familiar with udev, but I have been trying to dig through the docs on it to find a solution as it appears systemd-networkd cannot do this directly. – Kris Bahnsen Nov 17 '15 at 21:55
  • Interesting. Back in here, I can change the MAC, but I could swear it is the switch giving me the original one. I am not using systemd. But yes, I do remember reading something about same MACs being giving to different units. If you are selling that custom solution, leave out the name, we are alway on the lookup for possible home router machines. – Rui F Ribeiro Nov 18 '15 at 7:02
  • Its possible that whatever device you are using has a MAC stored in the CPU and then also written to EEPROM or internal flash in the switch chip that is auto doing its own thing. We simply decided to just allocate the number of MACs that are needed and attempt to assign them to the ports. Looks like it might involve more software work than originally hoped. – Kris Bahnsen Nov 20 '15 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.