<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 12, 2015 at 7:40 AM, Matthew Hall <span dir="ltr"><<a href="mailto:mhall@mhcomputing.net" target="_blank">mhall@mhcomputing.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Thu, Nov 12, 2015 at 12:12:55AM -0500, Matthew Hall wrote:<br>
> /etc/udev/rules.d/70-net-names.rules:<br>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", SUBSYSTEM=="pci", KERNELS=="0000:00:1f.6", NAME="eth0"<br>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", SUBSYSTEM=="pci", KERNELS=="0000:08:00.0", NAME="eth1"<br>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", SUBSYSTEM=="pci", KERNELS=="0000:0a:00.0", NAME="eth2"<br>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", SUBSYSTEM=="pci", KERNELS=="0000:0a:00.1", NAME="eth3"<br></span></blockquote><div><br></div><div>I'm not sure if udev even still _allows_ renaming to eth*, but even if it does, that's explicitly not supported. (For example, between the time eth0 appears and the "rename to eth1" rule gets processed, another eth1 might also appear, and the rename would fail.) If you want custom names, use en* or port* or lan* or some other prefix.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">For future users who hits this, I think I finally found the bug.<br>
<br>
You have to use the "SUBSYSTEMS" filter not the "SUBSYSTEM" filter. I am by<br>
far not an expert on udev and the rules are extremely confusing. Is there a<br>
better way to write this ruleset?</blockquote><div><br></div><div>The way they work is simple though – they directly compare the values you'd see in `udevadm monitor --env` or `udevadm info /sys/class/net/eth0`. If it says "SUBSYSTEM=net", then you can match it using SUBSYSTEM=="net", that's it.</div><div><br></div><div>But I guess the more important thing to know is that the network interface is _not the same thing_ as the raw PCI device; it's shown as a sub-device in /sys. (A single PCI device could easily expose multiple network interfaces, for example.) Compare the output of `udevadm info /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0` vs `udevadm info /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/net/eth0`.</div><div><br></div><div>That's why you use "SUBSYSTEMS=" and "KERNELS=" – you're checking information of the _parent_ device. That said, some of the matches are IMHO a bit redundant, and you'd be fine with:</div><div><br></div><div>ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:0a:00.1", NAME="em1"</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>></div></div>
</div></div>