I know that udev manages devices in /dev
and I expected to find information about available network cards (hardware) or at least network interfaces (software) there.
ifconfig
output shows me eth0
and lo
, but /dev/net
is empty. Well, almost empty:
$ ls -la /dev/net
total 0
drwxr-xr-x 2 root root 60 Dec 13 09:37 .
drwxr-xr-x 15 root root 4300 Dec 15 12:12 ..
crw-rw-rw- 1 root root 10, 200 Dec 13 09:38 tun
Why there is no info about network interfaces in udev
?
I'd really like to avoid executing ifconfig
in my server process.
It is irrelevant to the question, but I expected to find ids ("lo", "eth0") and IP addresses there.
udev is a device manager for the Linux kernel
. It is not said that it is only for devices that havedevice files
(what are those files anyway?). So, I don't get it - why information from/sys/class/net
can not be available in/dev/net/by-id
? – anatoly techtonik Dec 16 '13 at 17:36/dev
are supposed to be directly read from/written to. This works perfectly fine for block-devices, but is impossible for the way network interfaces work. A block device just provides access to raw chunks of data, while a network device needs way more information than simply the raw payload. – Elias Probst Dec 16 '13 at 19:49udev
does many things, however,/dev
has historically been solely for block- and character-special files, used to control, read from, or write to devices.udev
appears to honor this tradition, and doesn't place ordinary files there. Unix and its relatives have evolved, and there are now other places to place files to control, read from, or write to devices, such as/sys
and/proc
, but/dev
still almost exclusively contains block- and character-special files. – Mark Plotnick Dec 16 '13 at 19:52/dev
could be different and if there was any discussion about extending its meaning duringudev
planning. – anatoly techtonik Dec 17 '13 at 06:46