More than one ethernet adapter?

Hiyo! how do I change the default ethernet? dietpi keeps trying to use 1gbps port and telling me it has no connection after a reboot or two. this is using nativepc uefi.

How many interfaces does the device have? Are they assigned the same name every time? From your description it seems that this isn’t the case.
Also, are you using all the interfaces or just one?

It’s a qnap network storage which is pretty much just a Intel minipc . dietpi just calls them eth0 eth1 ect pretty sure they’re named the same every time and the device has 4 Ethernet ports. Oh also I only was using one port a 2.5gbps port not sure what it’s name is I don’t know where to look to see all of the Ethernet devices. I’ve always used dietpi-config.

you can check Ethernet device using ip a

hmm it seems after a restart the network adatpers names aren’t staying the same. causing dietpi to default to the wrong/different but (correctly set eth0 or whatever I set last restart) adapter… am i able to tell dietpi to use a adapter by its mac address instead of eth0 ect? I was needed this to be headless and i wasnt wanting to connect a monitor all the time but I am having to connect a monitor to log in and fix the adapter every restart. *Im only able to fix it by going into dietpi-config network section and disable then reenable and save then its connected again.

EDIT: yeah its weird the ethernet is doing a merrygo round its now at eth3 it was at eth0. i haven’t been changing the cables around by the way. oh also i have everything set to static.

We had a similiar problem some days ago, you can bind the interface names to a MAC address using udev rules.

1 Like

Interface name depends on the order the interface is coming up during boot. Fist interface ready will be eth0, next one is eth1 aso.

okay that explains the merrygo round. dog racing io… now I just need to figure out how to create this file? I don’t know what udev is. I’m sure this is what I’m needing though… any tips on how to use what you linked?

using a text editor like nano should be fine :smiley:

Or you mean the content of that file

i know how to edit a specific file in nano. that is as far as ive used nano. I dont even see a section in nano that says to create a file.

simply give it a name like

nano /etc/udev/rules.d/99-my-interface-name.rules

And as soon as you save the file, it will be created.

cool thank you. I’ll try it out in a second. :slight_smile:

edit: hmm made the file with rules and correct mac… but it didn’t seem to work.hmm

in my case, to make sure that everything worked as i wanted it to, i explicitly assigned each problematic interface a name using that udev rules file. once i finished editing the file, i ran this command:

sudo systemctl restart systemd-udevd

another thing to note using the udev “rules” file is that the number at the start of the file corresponds to when the order of execution the file gets in case the is another set of rules regarding the same interfaces. some guides recommend using the number 72, while what worked for me was 99

you can also use the following command:

sudo journalctl -u systemd-udevd --since today

right after a reboot to audit udev functionality.

Hope that helps

1 Like

@xangx can you share your udev rule? As an example for @kannz

hmm I’ll try again tomorrow. thank you for the help. I’ll see if I messed something up. also I was under the impression that only the mac address matters and needs to be changed. figured name doesn’t matter much either it’s just a name and I don’t have a wlan so changing it doesn’t matter as long as it isn’t the same as something else.

edit: had to give up my ssd to a friend so i need to wait to try this out later. im sure it will work fine when I try out the suggestions.