Hacker News new | past | comments | ask | show | jobs | submit login
Eth0 no more? (dell.com)
154 points by PassTheAmmo on Feb 23, 2011 | hide | past | web | favorite | 50 comments

I can understand why people will resist this, thinking that somehow renaming eth0 to em0 or similar will break stuff, but here's the rub: It'll only break stuff that's badly written.

There's a right way to enumerate network interfaces and a wrong way (which is dependent on the language you're using for enumeration - the wrong way is assuming that eth0 is the only network device).

Bear in mind that the new convention is not entirely dissimilar to how WiFi cards have worked on Linux for some time, so the only things that will break will be things that:

    a) Assume eth0 instead of enumerating devices
    b) Have a legitimate reason for using eth0 only (I can't think of one, but I wouldn't be surprised if one existed)

Documentation that references eth0 isn't badly written.

Yes it is. Obviously, this is just my anecdotal experience, but the first time I tried to install Linux the troubleshooting documentation I was working off of only mentioned eth0. I tried to configure everything to eth0, and nothing worked. I gave up and swore off Linux for years. Eventually, I tried Ubuntu, where everything worked, and figured it was a driver issue that Ubuntu had solved.

I got around to trying out Gentoo, which has amazing documentation that really drills down into what you're doing and why. That's when I ran ifconfig and iwconfig for the first time and realized I probably would have been using Linux years earlier if I had known how to find out that my NIC was wlan0.

So I'd say referencing eth0 throughout is fine, as long as at the beginning you take the time to point out that it may not be eth0, and more importantly, how to find out what it is.

How is that? Would you care to elaborate?

On the surface it would seem like you're correct, but only so in some cases.

If for example you're running Linux on a Macbook Air you have no eth0 by default. Ergo, documentation referencing it is technically incorrect - it would be possible to say badly written at this point but that's even more pedantic than your comment ;)

It's not rare for the WLAN subsystem to be accessed though an ethernet device name.

Mac OS X and Linux are the only OS's that I'm aware of that put all ethernet nics in the same device namespace.

Everyone else has separate device namespaces for - you might have an fxp0 , rl0, hme0, etc. on any BSD or Solaris machine.

Rather than looking in /dev, they really ought to be parsing the output of ifconfig -a.

1. Linux gives unique names to each NIC. There are no namespace conflicts, because each NIC alias is unique within devices. I personally do not care about the chipset manufacturer and driver when working on a routing issue.

2. You mean (IIRC) 'ip link show'. ifconfig on linux isn't maintained, and breaks in a bunch of situations (Aliases on VLANs on bonds, for one)

3. And you should of course use python-procfs or your preferred equiv, not parse the output of other tools.

On the article in general: can't you use /dev/by-manufacturer these days or similar? I haven't been working on OS stuff recently so can't remember if that became standard.

somewhat OT:

> 2. You mean (IIRC) 'ip link show'. ifconfig on linux isn't maintained, and breaks in a bunch of situations (Aliases on VLANs on bonds, for one)

This seemingly simple change seems to be taking forever to gain traction; "use `ip` for network config on linux".

There is so much googlable stuff instructing one to use ifconfig, route, etc. that it seems to self perpetuate. I often find people telling others that "you can't do that in Linux", when the real answer is along the lines of "you can't do that with the route command" (to give an example that I've seen a few times recently, route can't manipulate routing tables)

It's not that it self-perpetuates, it's that nearly every other Unix does it that way, and thus there's an expectation that ifconfig, if it exists, has similar functionality on all platforms.

If you're going to deprecate a command, make running the old one either:

1. Not exist, and thus have the shell throw an "command not found" error

2. Print a useful message like "Use <newcommand> instead"

3. Work, but do #2 as well.

The current situation is like leaving a pair of rusty pliers out in the open, and hiding the brand new socket set when the goal is tightening a bunch of bolts.

Yeah, the Linux distros (which themselves obviously only use 'ip') should have done #2 10 years ago.

When I worked at Red Hat (till 2005) their official RHCE documentation still told people to use ifconfig and route.

I agree wholeheartedly that the old tools should be hidden away, and I assume that they haven't been, because that will break more things than the actual renaming of devices. I bet even adding deprecation warnings could cause a ruckus, seeing how many times I've come across `ifconfig | something` both in scripts and people shelling out from other languages. I do wish the distros would just make a clean break, and let people fix their crappy code.

Then you just make the deprecation warning go to stderr instead of stdout. '|' only redirects stdout.

True - I'm just grasping as straws to come up with an excuse as to why this has gone on for so long.

Love the tools analogy! So true. LOL

I used ifconfig until about halfway through last year when someone pointed 'ip' out to me. I kept using ifconfig right up until the point I found that ip didn't require root rights...

Neither needs root privileges to display interface status. Perhaps it's a PATH issue for you - sbin/ is often left out of the PATH for regular users.

Fair enough, thanks for the info. I just generally found that I couldn't simply make it work on a standard debian install and assumed it was permissions.


Having all ethernet devices called "ethX" makes it much easier to parse the output of ifconfig and exclude any non-ethernet interfaces (tunnels and such).

My primary network interface has just become "en0" again, after being "en1" for about 8 years (the time between my first iBook with 802.11b, and getting a MacBook Air which doesn't have an ethernet port).

From the limitations section of the wiki page linked in the article:

Not all add-in cards have a method to expose their Linux interface name(s) to external port mapping. biosdevname may provide incorrect names for such. Discussions are ongoing on the netdev mailing list to standardize a method of exposing such mapping.

Seems like this would be kind of a deal-breaker for any wholesale move like this. I'd be fairly surprised if this got any widespread adoption anytime soon.

Looks like this https://fedoraproject.org/wiki/Features/ConsistentNetworkDev... is going to be the default in Fedora 15.

There was a pretty good discussion about this on LWN a while back, I recommend it to anyone who wants more information (both the commentary their, as well as the linked article): https://lwn.net/Articles/424859/

Here is a whitepaper from Dell that discusses some of these issues and provides some of the solutions. It is a couple of years old but still relevant:


The BSDs have always done this... if I recall correctly, em is an Intel based NIC.

NAME em - Intel PRO/1000 10/100/Gigabit Ethernet device


Edit: Reading more of that thread I may be off-base here, but naming a network interface em that's not powered by certain Intel chipsets will be very confusing to BSD users. Just my 2 cents.

People will whine and complain about this, but it's about time some sanity was brought to Linux's network device names. The eth* enumeration has been terrible for quite a long time, especially when dealing with servers housing multiple interfaces. And if you don't like the solution, they explicitly say you can just set biosdevname=0 on the kernel params and carry on with the previous insanity.

Looks like this could solve the problem of network interfaces renaming themselves after reboots. Hooray!

Network interfaces should not rename themselves after reboots. On Red Hat derived distributions, the device name is tied to the MAC address of the interface, so it never changes.

On other distributions, "udev" accomplishes the same thing.

The only point when interface naming is arbitrary is at installation time, then it stays the same forever.

Not only this will add confusion by introducing a bunch of new names for network interfaces, it will also break applications that rely on them being called "ethX".

It will also make it impossible to manually assign names to interfaces. For instance, if you have a configuration that uses an embedded interface and you want to add another interface on a card, you can manually assign the same "ethX" name to it, but not if the names depend on the physical characteristics of the hardware.

No, you can still rename interfaces using udev just like you can now. This is largely about ensuring that devices get predictable name at install time. As is pointed out in the LWN comment thread, for anyone who has to provision large number of servers with multiple NICs that connect to different networks this is a godsend.

Ability to rename: http://lists.us.dell.com/pipermail/linux-poweredge/2010-Nove...

Why the eth prefix can't be used: http://lists.us.dell.com/pipermail/linux-desktops/2011-Febru...

More background: http://domsch.com/blog/?p=455

Why not give an argument to the kernel to create the new devices as "fooX" (foo being a supplied parameter) - and let udev userland deal with the renaming to "ethY" as it pleases ?

While this novelty certainly may appeal to the folks who are used to alphabet soup in the network adapters list, and I too think that the adapters that distinguish between the T568A and T568B cable layout have a degree of coolness in them by creating an extra value in being able to distinguish between the straight and crossover cables - overall it seems like a step back to me.

I would plug in the interfaces into a switch - and all I care is to find the same MAC address as I see on the switchports - not which bus they attach to.

Good point, however, the problem is only half-solved.

If the machine is coldstarted then previous devices could be randomly reshufled. Imagine you have a datacenter with 100 machines and you have some kind of provisioning scheme where you coldstart them often. It would be a nightmare having to run ethtool -p <dev> and replug cables.

We have solved the problem by providing a consistent algorithm of sorting all the devices in a udev callback. We have a known set of hardware so we know which cards are add-ons (our machines have 4+ eth ports) and which ones are built-ins. So it works out, however, it would be nice to generalize it somehow.

> If the machine is coldstarted then previous devices could be randomly reshufled.

The detection order would change, but the ifcfg file (RH) or udev rules (SuSE and others) would not change, so your NICs will stay the same these days.

ifcfg file is auto-generated by the coldstart. But you are right, if we save and restore ifcfg files then it would work. However if this saving and restoring has to be done after machine is coldstarted, its eth0 could be connected to another network completely.

The first time the OS boots, the MAC addresses in ifcfg files are generated. Subsequent cold starts only read the files, they do not write them.

That is the the problem I am trying to convey -- the machines are coldstarted often and MAC addresses are reshufled on every first boot. If your cable to the management network is connected to left socket on the motherboard, that left socket needs to be eth0 on every coldstart. Sometimes it is not. "Yes" after the first boot when ifcfg files has been written it will be stable, but that mean someone has to go and either hand-edit ifcfg files or run ethtool -p eth0 and replug the cables.

> Subsequent cold starts only read the files

No they don't. Thare no files to read. You just wrote above in your commetn that the first time OS boots ifcfg are generated. So after a machine is coldstarted there are no ifcfg files! They are generated once per coldstart and saved. Then during each restart those files are read and everything is fine.

Now, I was saying, you can have a provisioning scheme where during coldstart, in your kickstart file you can fetch and write stable ifcfg files to prevent machines from creating their own. What we do instead is install a custom RPM with a udev script where an algorithm sorts the network interfaces in a stable way (since we only deal with a known and limited set of motherboards and network cards).

> No they don't. Thare no files to read. You just wrote above in your commetn [sic] that the first time OS boots ifcfg are generate [sic]. So after a machine is coldstarted there are no ifcfg files!

As long as you don't reinstall your OS, or lose your data, your config files are there. Cold starting hardware does not delete data.

Are you trolling?

> Cold starting hardware does not delete data.

Alright, figured it out. When you talk about coldstaring you really mean restarting the machine, as in pressing the reset button for example. When I talk about coldstarting I mean starting with a bare hardware box and installing an OS on it.

> Are you trolling?

Actually I thought you were. Sorry for the misunderstanding.

[EDIT: I won't edit my previous posts, otherwise your posts won't make sense, let others laugh at my bad English (it is a 3rd language so I don't mind)]

No probs. Most places I've worked at use 'provision' or 'bare metal' for an os install plus mop up work, starting cold as a way to differentiate from warm booting, appreciate different places may have different systems though. Thanks for being classy about it :-)

> Network interfaces should not rename themselves after reboots.

But that's because PCI bus walk order doesn't change across reboots.

Moving a PCI card to another slot should also not rename the device. With a typical current udev setup, device names are persistent based on MAC address. With this proposal, either the name will change if the bus topology changes, or bus location based names will be _wrong_. As usual the fedora/desktop trolls are breaking perfectly good things for no apparent reason at all.

Well it depends. There is a kernel parameter that forces a consistent walk order:

It forces breadth-first device sorting.

But otherwise I understand that devices are detected in parallel and whichever ones return first are designated eth0, eth1 etc.

We had this problem on some machine that have 4+ eth0 devices. We use RHEL|CentOS 5.x (see in the post above how we solved the problem).


I once had a server (in the pre-udev era) that would occasionally shuffle its network devices after reboots. I don't remember how I fixed it but I do remember the short phase of amusement, followed by a longer phase of frustration.

There are a lot of other solutions to that. The Ububuntu one I favored in the 8.x era was /etc/iftab, it's a shame they retired it in favor of udev.

While udev is more universal, iftab felt elegant and unixy.

From a quick look on a fresh ubuntu small server install it does not seem there is much that reference eth* scheme :

  ~$ sudo egrep -Irl 'eth[0-9]' /etc /usr 2>/dev/null |wc -l

With eth changing to em and mile long IPv6 addresses it's going to be a strange world.

I assume any consumer OS will generate a symlink for compatibility reasons.

Network interfaces aren't files, so you can't create symlinks to them. I don't think linux has a facility for referring to a network interface by more than one name.

My hope is that consumer distributions will stop presenting the device name and configuration at all. When I'm trying to show new Ubuntu users how to connect to wired and wireless networks, it's annoying to have to explain what NetworkManager means by "Auto eth0".


I certainly hope so. There's just way too honking much literature out there oriented on ethX to simply make ethX go away.

'know' one knows?

"... something else that know one will recognise ..."


Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact