Mysteries of /dev/eth?

Luciano Rocha strange at nsk.no-ip.org
Thu Sep 20 16:41:32 UTC 2007


On Thu, Sep 20, 2007 at 04:46:00PM +0100, Timothy Murphy wrote:
> 
> I'm puzzled by the device /dev/eth0 , etc,

It's just eth0, not /dev/eth0.

> chosen by different drivers.

It's not chosen by the drivers. It's automatically assigned by the
kernel, in chronological order (regarding device registration). Also,
the userland can change a device name as it pleases. (You could name it
yourself: /sbin/ip link set eth0 name ne0

> This isn't a problem for me, just a mystery.
> 
> For example, I just installed Fedora-7 on a laptop
> (an old Sony PictureBook - C1VFK)
> and when I attached it by ethernet to my LAN,
> it immediately worked through /dev/eth0 ,
> despite the fact that /etc/modprobe.conf
> had an incorrect "alias eth0 orinoco_cs",
> while the driver in use is pcnet_cs .

It's no longer necessary to define the module for a network device, as
the boot scripts correctly load modules for the PCI devices they find.

> 
> By contrast, on another laptop
> although I have the correct "alias eth0 orinoco_cs"
> in /etc/modprobe.conf , a strange device -
> /dev/dev1375 , IIRC, was used.

That's because a configuration already exists for eth0, that specifies a
different MAC address from the one in the current device. Check
/etc/sysconfig/network-scripts/ifcfg-eth0.

It should have a line like:
HWADDR=00:01:11:22:23:33

The correct value can be found with:
/sbin/ip addr show dev1375 scope link

Or just /sbin/ifconfig and check the output.

The unusual name, dev1375, is dynamically generated so that it doesn't
conflict with another device.

> 
> So my questions are:
> 
> 1) How does the machine decide which driver to use; and

The modules/drivers have a list of PCI ids that are used to match
drivers/modules with devices.

> 2) How does it decide which device to use?
> 
> Has it got something to do with udev ?

It depends on your distribution. I think in F7 udev does the module
loading, and there is development for persistent network device names,
but that isn't yet used (by default) in Fedora 7.

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070920/0b6f5b87/attachment-0001.bin 


More information about the users mailing list