The officially official Devuan Forum!

You are not logged in.

#1 2018-11-20 06:23:19

gdstew
Member
Registered: 2018-11-20
Posts: 3  

persistent network interface names with multiple interface cards

How can I get persistent net interface names on multiple network interfaces? I am using the wicd network manager on my primary network interface and it is the only
one configured in wicd.

When I tried using a hand generated /etc/udev/rules.d/70-persistent-net.rules file I get these error messages during boot:

Waiting for /dev to be fully populated...
[...] udevd[397]: Error changing net interface name eth2 to eth1: File exists
[...] udevd[395]: Error changing net interface name eth1 to eth0: File exists
[...] udevd[393]: Error changing net interface name eth0 to eth2: File exists

This is the setup in the 70-persistent-net.rules file:

UBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:29:d3:0f:01", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="04:4b:80:08:80:03", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:e9:bd:1c:b7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"


and this is the /etc/network/interfaces file:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth1
iface eth1 inet dhcp

# The distributed compile/cluster network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.109
netmask 255.255.255.0

# The first test interface
allow-hotplug eth2
iface eth2 inet static
address 192.168.69.96
netmask 255.255.255.0


and this is what ifconfig reports:

root@testy123:# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.109  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 2605:6001:e20b:9400:215:e9ff:febd:1cb7  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::215:e9ff:febd:1cb7  prefixlen 64  scopeid 0x20<link>
        ether 00:15:e9:bd:1c:b7  txqueuelen 1000  (Ethernet)
        RX packets 146  bytes 15152 (14.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7  bytes 606 (606.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 18 

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:01:29:d3:0f:61  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 18 

eth2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.69.96  netmask 255.255.255.0  broadcast 192.168.69.255
        ether 04:4b:80:08:80:03  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 8  bytes 480 (480.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 480 (480.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


All of the searches I've googled come up with systemd related responses. I've also scanned and searched this forum and could not find any that helped although a couple of them addressed related problems.

Offline

#2 2018-11-20 20:59:33

fsmithred
Administrator
Registered: 2016-11-25
Posts: 927  

Re: persistent network interface names with multiple interface cards

One solution would be to force eudev to use the new naming scheme. Add 'net.ifnames=1' to the boot command, and you'll get interface names that will not change.

Offline

#3 2018-11-20 22:38:21

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 276  

Re: persistent network interface names with multiple interface cards

Firstly, do these interfaces really initialize in different orders at different boots, or are they always in the same order?

The example you present suggests that "04:4b:80:08:80:03" is first, then "00:01:29:d3:0f:01", and then "00:15:e9:bd:1c:b7". If that is always the boot order, then you would do best in naming the first one "eth0", the second one "eth1" and the the third one "eth2", since that coincides with what they are initialized as.

If there is initialization randomness, then you do best in naming them on a naming scheme apart from "ethN", since that will avoid name clashes. The suggestion by @fsmithred might work if their "bus addresses" remain fixed, but it's probably better if you use a scheme of your own, say "eN".

If you also really need them to be named "ethN" in your way, then you must rename twice: first to a different scheme, then back to the "ethN scheme". In that case, you cannot really rely on udev to configure them, since the configuration has to be postponed until after the double renaming (and not on "first sight"). I think you are in scripting territory with that.

Online

#4 2018-11-27 04:30:17

gdstew
Member
Registered: 2018-11-20
Posts: 3  

Re: persistent network interface names with multiple interface cards

Thank you both for your replies.

I should have been a little clearer with my description of the problem. This computer
is also used to test hardware. eth0 and eth1 (always present on the motherboard) swap
names when the eth2 card is inserted into a PCI slot to test it. When I used
70-persistent-net.rules with (pre-systemd) Debian this did not happen and I got the
persistent net names I wanted which is, as I understand it what 70-persistent-net.rules
was for. I'm not sure if they swap back when eth2 is removed. I had a new
problem with my test setup, my ISP overriding ping addresses, so it got a little
hectic as I had to spend time finding a fix for a previously working test setup.

In the process of searching for answers to this problem I found out that systemd
programmers are now responsible for udev and that eudev is a Gentoo fork of the
earlier udev. It does not seem to work like it use to when it comes to persistent
net names.

I tried @fsmithred's idea and as far as I could tell it made no difference even with
the "bus addresses" being fixed on eth0 and eth1 and with eth2 in the same PCI slot
through both reset and power sequence events.

I would like to be able to force which network interface name is used for a particular
hardware interface to maintain consistent network interface names across multiple
computers with multiple Ethernet interfaces in my distributed compile/cluster setup
and of course on the test computer. From your response it looks like using my own
naming convention is the best (OK, easiest) route. This computer has been moved
off of my test bench while I try to install Devuan on my first UEFI motherboard so it
will be a while before I can try it.

Offline

#5 2018-12-05 23:44:11

gdstew
Member
Registered: 2018-11-20
Posts: 3  

Re: persistent network interface names with multiple interface cards

I finally got back to trying using interface names other than ethN  and it does indeed fix the problem I was seeing. Thanks !

Here are the details:

This is the new setup in the 70-persistent-net.rules file

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:29:d3:0f:01", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ethr0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="04:4b:80:08:80:03", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ethr1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:e9:bd:1c:b7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ethr2"

and this is the new /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ethr1
iface ethr1 inet dhcp

# The distributed compile/cluster network interface
allow-hotplug ethr0
iface ethr0 inet static
address 192.168.10.109
netmask 255.255.255.0

# The first test interface
allow-hotplug ethr2
iface ethr2 inet static
address 192.168.69.96
netmask 255.255.255.0

and the network interfaces wired interface name in wicd preferences was changed to ethr1

Offline

Board footer