How to setup "static" mac with multiple network devices?

I just installed DiePi 8.11 on an NanoPi R1 via ethernet.
Because the R1 has a WAN and a LAN Port, I had to fiddle around to get a working network port.
Sadly the default install uses only the slow eth0 (WAN) port. Eth1 stays unused.

I did not find any DietPi documentation how to setup network outside of dietpi-config. But in Debian docs I found that I had to edit /etc/network/interfaces.

cat /etc/network/interfaces

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Ethernet
allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Ok, seems that I have to add an entry only. So I copied the eth0 entry’s to /etc/network/interfaces.d/eth1.conf and modified them.

allow-hotplug eth1
iface eth1 inet dhcp
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

After rebooting the system eth1 is up and running. But every time the system reboots, or just after a reconnect the mac address is changed.
Thats ugly, because my router detects unknown mac addresses. And sends me tons of info mails.
The changing mac adresses prevents me to set the mac as “static” in the dhcp server (dnsmasq) on the router.

Since the mac on eth0 did not change, but on eth1 does: What is the DiePi way to get a non changeing mac ?

And …
Should I remove eth0 from /etc/network/interfaces ?

just a question, do you need both eth0 as well as eth1 up at the same time? Or just one of them?

DietPi is a new world to me since some day’s.

At the moment I only need one eth interface at the R1, since I’m trying to setup a octoprint server.
But that may change in future, and I like to understand how the system is working …

For network hardware I prefer using OpenWrt.
I’m running a NanoPi R2S as main router to my external IPv6 fiber line. Some Archer C7 as dump AP’s, some GS108 switches, and a Freifunk Offloader running on Proxmox. Combined with some VLAN’s, Wireguard, adguard, …

If you need one interface only, you could continue using eth0. No need to add an additional one eth1.

But eth0 is slow, and eth1 is Gigabit.
A noticeable difference when streaming full-hd video’s …

I see, did you tried to specify a MAC address on your eth1 interface configuration? Something like following could be added.

hwaddress ether 82:E3:A3:BB:39:34

Hello,

specifying a fixed mac in eth1 interface configuation seems somewhat unusual to me.
But if this is the standard way in DietPi its ok for me too.

But this is what you asked for:
How to setup “static” mac with multiple network devices?
Or did I understand it wrong?

This is not dedicated to DietPi. Just search the web for dynamic MAC address on NanoPi. You will find entries for every other os as well.

My question in the first post was how the problem is handled under DietPi !!
This question is ultimately completely independent of any SBC. I think it is strategically unwise that the answer is now reduced to a NanoPi. Ultimately, all SBCs that have multiple ethernet interfaces are actually affected.
It only makes sense to first find a solution for a dedicated device if there is no general strategy under DietPi on how to deal with it.

And making adjustments in /etc/network/interfaces.d/… is a way that is completely unusual in other non-Debian-based distributions.
For example, Arch Linux based distributions do not even have a /etc/network directory…

You answered yourself. Using /etc/network/interfaces is quite standard on Debian based system where ifupdown is manging network connecting’s. Comparing it with a non-Debian system doesn’t make sense.