Gentoo Archives: gentoo-user

From: Dan Johansson <Dan.Johansson@×××.nu>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: udev upgrade renames eth-interfaces
Date: Sun, 17 Mar 2013 09:53:52
Message-Id: 2888772.qhxvxar0aE@queen
In Reply to: Re: [gentoo-user] Re: udev upgrade renames eth-interfaces by "Canek Peláez Valdés"
1 On Saturday 16 March 2013 12.08:23 Canek Peláez Valdés wrote:
2 > On Sat, Mar 16, 2013 at 11:03 AM, Dan Johansson <Dan.Johansson@×××.nu> wrote:
3 > > On Saturday 16 March 2013 09.39:17 Jonathan Callen wrote:
4 > >> > Hello,
5 > >> >
6 > >> > Today I upgraded udev on one of my boxes (after hesitating a long
7 > >> > time). Even if I have /etc/udev/rules.d/80-net-name-slot.rules and
8 > >> > my old 70-persistent-net.rules in place, my interfaces gets renamed
9 > >> > (eth0 gets swapped with eth1) which then messes up my whole
10 > >> > configuration (routing tables and firewall rules). Any suggestion
11 > >> > how to keep my old names and order?
12 > >> Udev, as of version 187, will now refuse to rename a network interface
13 > >> to the name of a network interface that already exists -- which, due
14 > >> to race conditions, can be the case if you are attempting to rename a
15 > >> network device to a name the kernel will later use to name the next
16 > >> enumerated device. The fix for this issue is to *not* use names that
17 > >> match "eth[0-9]*", "wlan[0-9]*", etc. and instead use a name that the
18 > >> kernel would *not* automatically assign. Unfortunately, that means
19 > >> that you *cannot* keep your old names and order (upstream claims that
20 > >> the means used to ensure those names were used was unreliable and
21 > >> prone to race conditions anyway, which, looking at the code, I can
22 > >> believe).
23 > > This is great...
24 > > (I hope you can hear the irony)
25 > >
26 > > 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.
27 >
28 > That's the smart thing to do.
29 >
30 > > 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).
31 >
32 > http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
33 >
34 > http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c
35 >
36 > Basically, "en" is for "ethernet", "p" is for "PCI bus", and "0s4" and
37 > "0s5" is for the topology of the cards in your machine: the cards are
38 > in the PCI bus number 0, slot number 4 and 5. In other words, if you
39 > do "find /sys -name enp0s4", I'm betting you will get something like:
40 >
41 > /sys/devices/pci0000:00/0000:00:1c.1/0000:00:004.0/net/enp0s4
42 >
43 > The "0000:00:004.0" is the part that determines the naming of yout
44 > device. This naming is deterministic: as long as you don't move the
45 > cards from PCI slot, they will be named like that always.
46 >
47 > > 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
48 > > Now I could start the two network interfaces (/etc/init.d/net.enp0s[45] start).
49 > > 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.
50 > > What have I missed???
51 >
52 > Do you have net.eth0 or net.eth1 in /etc/rc.conf?
53
54 No, but I still had the links in /etc/init.d/. Removing those and adding lins for enp0s[45] did the trick.
55
56 Thanks,
57 --
58 Dan Johansson, <http://www.dmj.nu>
59 ***************************************************
60 This message is printed on 100% recycled electrons!
61 ***************************************************