18 January 2009

First time I boot my UML guest, I got eth0, then eth1..and so on, why?

It has been itching my head for a while, "why my Slackware UML guest OS gets different eth device name everytime it boots?". It's always incremented e.g first boot I got eth0, later I got eth1 and so on. For note: I didn't build the Slackware by myself, I downloaded from somewhere. Maybe it's uml.harlowill.com or something, sorry I couldn't recall. One thing for sure, it's Slackware 12.0

Previously, I absolutely had no idea why it happened. But lately I was thinking it could be something with udev (after all, it is the one which deals with device file, right?).

Let's boot the UML guest one more time and find out what we could dig. Note that I use the following parameter when I invoke the guest:

Guest boots up and login prompt shows up. udev should put its configuration under /etc/udev or something alike, so let's dive. Found it, it's in /etc/udev/rules.d/75-network-devices.rules. Here is the snippet that explains my headache:
KERNEL=="eth?", ATTR{address}=="4e:82:25:ae:b1:bb", NAME="eth0"

I see the correlation now. If I don't specificly declare the MAC address of the ethernet device my UML guest will use, UML will pick one randomly. And udev inside the guest will think it's a different ethernet device.

Finally, simple solution. Put that MAC address as part of "eth" parameter:

Now I get consistent naming!

PS: Looks like my "research" insting is back. Hopefully, it will stay inside me for long time....



How to execute multiple commands directly as ssh argument?

 Perhaps sometimes you need to do this: ssh user@ ls It is easy understand the above: run ls after getting into via ssh. Pi...