Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: udev upgrade renames eth-interfaces
Date: Sat, 16 Mar 2013 18:08:35
Message-Id: CADPrc83khiVA8yYx+yLED7VQe0Q4jfak6DoJaymhcWUZWVeCqw@mail.gmail.com
In Reply to: Re: [gentoo-user] Re: udev upgrade renames eth-interfaces by Dan Johansson
1 On Sat, Mar 16, 2013 at 11:03 AM, Dan Johansson <Dan.Johansson@×××.nu> wrote:
2 > On Saturday 16 March 2013 09.39:17 Jonathan Callen wrote:
3 >> > Hello,
4 >> >
5 >> > Today I upgraded udev on one of my boxes (after hesitating a long
6 >> > time). Even if I have /etc/udev/rules.d/80-net-name-slot.rules and
7 >> > my old 70-persistent-net.rules in place, my interfaces gets renamed
8 >> > (eth0 gets swapped with eth1) which then messes up my whole
9 >> > configuration (routing tables and firewall rules). Any suggestion
10 >> > how to keep my old names and order?
11 >> Udev, as of version 187, will now refuse to rename a network interface
12 >> to the name of a network interface that already exists -- which, due
13 >> to race conditions, can be the case if you are attempting to rename a
14 >> network device to a name the kernel will later use to name the next
15 >> enumerated device. The fix for this issue is to *not* use names that
16 >> match "eth[0-9]*", "wlan[0-9]*", etc. and instead use a name that the
17 >> kernel would *not* automatically assign. Unfortunately, that means
18 >> that you *cannot* keep your old names and order (upstream claims that
19 >> the means used to ensure those names were used was unreliable and
20 >> prone to race conditions anyway, which, looking at the code, I can
21 >> believe).
22 > This is great...
23 > (I hope you can hear the irony)
24 >
25 > OK, so I removed the two udev rules (70-persistent-net and 80-net-name-slot) files, thinking if this is the way the "upstream devs" are going then I have to check it out.
26
27 That's the smart thing to do.
28
29 > After removing the udev-rules and rebooting I got my two new network interfaces called enp0s4 and enp0s5 (no idea what that is supposed to mean).
30
31 http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
32
33 http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c
34
35 Basically, "en" is for "ethernet", "p" is for "PCI bus", and "0s4" and
36 "0s5" is for the topology of the cards in your machine: the cards are
37 in the PCI bus number 0, slot number 4 and 5. In other words, if you
38 do "find /sys -name enp0s4", I'm betting you will get something like:
39
40 /sys/devices/pci0000:00/0000:00:1c.1/0000:00:004.0/net/enp0s4
41
42 The "0000:00:004.0" is the part that determines the naming of yout
43 device. This naming is deterministic: as long as you don't move the
44 cards from PCI slot, they will be named like that always.
45
46 > My next step was to replace eth0 with enp0s5 and eth1 with enp0s4 in /etc/conf.d(net and create two new links (net.lo -> net.enp0s[45]) in /etc/init.d
47 > Now I could start the two network interfaces (/etc/init.d/net.enp0s[45] start).
48 > BUT, as soon as I try to start some service (sshd, ntpd, ...) that is using the network I get a lot of complains that eth0 and eth1 is not started (and can not be started) and the service wont start.
49 > What have I missed???
50
51 Do you have net.eth0 or net.eth1 in /etc/rc.conf?
52
53 Regards.
54 --
55 Canek Peláez Valdés
56 Posgrado en Ciencia e Ingeniería de la Computación
57 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] Re: udev upgrade renames eth-interfaces Dan Johansson <Dan.Johansson@×××.nu>