Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Without udev, who/what names ethernet devices?
Date: Fri, 07 Jun 2013 08:08:08
Message-Id: 51B19497.9080108@gmail.com
In Reply to: [gentoo-user] Without udev, who/what names ethernet devices? by Chris Stankevitz
1 On 07/06/2013 06:12, Chris Stankevitz wrote:
2 > Hello,
3 >
4 > A USB serial device is identified by the characters "/dev/ttyUSB0".
5 > One might call this string a "device on your filesystem" and it can be
6 > opened/closed just like any other entry in the filesystem.
7 >
8 > An ethernet device is sometimes represented by the string "eth0".
9 > Regarding this string "eth0":
10 >
11 > 1. What does this string represent? Is it a file on a filesystem?
12 > (no!) Is it okay for me to call it an "ethernet *device*"
13
14 It's just a name. Your name is Chris, mine is Alan and it's is eth0.
15
16 We usually just call it an interface
17 >
18 > 2. Assuming udev is not running, who/what comes up with the name
19 > "eth0"? How does that person/thing know how many ethernet devices
20 > there are and in what order to enumerate them? What happens if
21 > ethernet devices are dynamically added (e.g. a USB ethernet device or
22 > a driver being loaded/unloaded)?
23
24 The kernel driver gives it that name based on what it finds when it
25 probes your hardware. Kernel drivers strives for some form of
26 consistency in picking names, but the order they are found in is
27 somewhat random-ish. This means you cannot guarantee that the number on
28 the end is always going to be the same every boot - hardware just does
29 not work that way
30
31 When you hotplug a device, the driver does what it's coded to do -
32 usually assign the next available number. There is no guarantee all
33 drivers will always do this always - it's by convention
34 >
35 > 3. How does (2) change when udev is running?
36
37 Depends.
38
39 If you like the kernel naming scheme and want to keep it, just tell udev
40 to not fiddle with names and keep them as they are.
41
42 If you like the way udev does things and want to go with it's scheme,
43 follow recent recommendations on this list. udev will rename the
44 interfaces to it's own scheme based on the rules you set up.
45
46 What you CANNOT do with udev is eg switch the names eth0 and eth1 around
47 after the kernel has named them. That was tried for years, it doesn't
48 work. So now udev never interferes with kernel namespace, it create it's
49 own namespace
50
51 For more info, research this list going back about 4 months. The whole
52 topic was discussed at length. Search for "udev persistent names". A
53 word of warning - it wasn't pretty at the time and nothing changed just
54 becuase those mails are now archived :-)
55
56
57
58 --
59 Alan McKinnon
60 alan.mckinnon@×××××.com

Replies

Subject Author
Re: [gentoo-user] Without udev, who/what names ethernet devices? Mick <michaelkintzios@×××××.com>
Re: [gentoo-user] Without udev, who/what names ethernet devices? Chris Stankevitz <chrisstankevitz@×××××.com>