1

On my TX2 device I have two interfaces eth0 and an additional enp1s0.

The problem is that sometimes the first interface is eth0 and sometimes eth1 after boot. enp1s0 is always enp1s0.

How can I make sure that I always get eth0 as the first interface and not eth1?

1

You can assign static names to devices using udev and the mac addresses of the ports.

Create

/etc/udev/rules.d/99-persistent-net.rules

And add:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:69:62:r3:c1", ATTR{type}=="1", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:69:62:r3:c2", ATTR{type}=="1", NAME="eth0"

Making sure to change the mac address to that of your adapters. They can be found with the ifconfig command. Reboot your PC once all that is done.

See for more info: https://www.freedesktop.org/software/systemd/man/udev.html

|improve this answer|||||
  • What if I have, let's say, tens of devices? One cannot manually configure each one of them. – user205301 Dec 7 '19 at 8:59
  • 1
    While there may be a way to do this with udev, I dont have the knowledge to accomplish it. I personally would look at writing a bash script to iterate over your devices and create rules to use. – teeedubb Dec 9 '19 at 2:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.