[svlug] udev & net devices (was Re: Inits)

Sarah Newman newmans at sonic.net
Sat Jan 17 19:15:15 PST 2015


On 01/17/2015 05:27 PM, Akkana Peck wrote:
> Rick Moen writes:
>> At the time, I said that /etc/udev/rules.d/70-persistent-net.rules is
>> 'obviously intended to ensure that a specified MAC address always ends up as
>> eth0' on the described system.  That file says:
>>
>> # PCI device 0x8086:0x100e (e1000)
>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:aa:b2:05", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
>>
>> However, shortly after posting that, I realised that it's not quite that
>> simple.  The cited plumbing appears to say to udev 'Any time you receive a
>> uevent from the kernel letting you know that the kernel heard from the PCI
>> controller chip that MAC address 08:00:27:aa:b2:05 has been spotted, create
>> add an eth0 special-file node to /sys/class' -- or something like that.[1]
> 
> Yes, that also my understanding of what the rule is doing.

The kernel assigns a default name and if udev finds it does not match, it requests that the kernel
rename the device. The output of 'udevadm monitor --property' shows this happening and there's also
a message in the kernel log, at least with systemd.

Poking in the systemd code there is an ioctl called SIOCSIFNAME to make the request.

I'm not sure if any other devices can be renamed. But for everything with a device node, udev
creates or can create symlinks which should be named consistently no matter how the kernel names the
device.

--Sarah



More information about the svlug mailing list