Harald Hoyer <harald.hoyer(a)gmail.com> wrote:
Am 08.11.2015 um 17:14 schrieb Björn Persson:
> Christopher <ctubbsii-fedora(a)apache.org> wrote:
>> I recently updated my desktop to f23, and it went smoothly, for the most
>> part. However, it broke my mediatomb server because the NIC changed from
>> em1 to eno1.
>
> On any computer where it matters which network interface is connected
> to which network, I recommend writing some Udev rules to set permanent
> interface names based on the MAC address.
>
> Write a file named /etc/udev/rules.d/01-network-interface-naming.rules
> with content similar to this:
>
> SUBSYSTEM=="net", ATTR{address}=="00:0c:46:16:dc:b0",
NAME:="world"
> SUBSYSTEM=="net", ATTR{address}=="00:1e:8c:cf:dc:e5",
NAME:="gigabit"
> SUBSYSTEM=="net", ATTR{address}=="fc:f8:ae:ea:08:85",
NAME:="wifi"
>
> "01" in the filename causes it to be loaded before other files with
> higher numbers. Assignment with ":=" prevents later rules from
> clobbering the names. I found that capital letters don't work in the
> hexadecimal MAC addresses, so write them with small letters.
>
> We shouldn't have to do this manually, and it definitely shouldn't be
> as difficult as it was to find out how to do it, but on the upside you
> get meaningful names so that you won't have any trouble remembering
> which interface is which.
>
> (I hope no one turns Udev inside out anytime soon.)
Please don't do this.
I tend to not listen much to people who tell me to do stuff without
stating any reasons. If you want me to change, and you're not in a
position to give me orders, then you need to explain why the thing I'm
doing is bad.
For MAC based name assignment you can use the ifcfg-*
files with HWADDR="<MAC>".
Are you saying that HWADDR is a selection? It's described in
/usr/share/doc/initscripts/sysconfig.txt as "ethernet hardware address
for this device". That sounds like an assignment to me, assigning a new
MAC address to the interface. If it would say "of" instead of "for",
then I would understand it as a selection. I'll admit though, that
if HWADDR is a selection, then it's easier to understand why both HWADDR
and MACADDR exist.
Then I would need a way to use the ifcfg file to assign a name to the
interface. I can find two candidates: DEVICE, and the interface name
that is part of the filename. DEVICE is described as "name of physical
device". Using "of", that sounds like a selection: "Apply the
settings
in this file to the interface that has this name." As for the filename,
I've always assumed that that was either a selection or just a name
without any special meaning. Using the filename to assign a name to an
interface would seem really weird. Also, I don't see any explanation of
how DEVICE and the filename interact.
Furthermore, my backups show that the ifcfg files I had when I upgraded
from Fedora 15 to 17 did contain both HWADDR and DEVICE, and that didn't
prevent the interface names from changing unpredictably on every reboot.
Apparently there was a race between two or more components that each
tried to set its own interface names. I pieced together those Udev rules
based on hints I found on various blogs, and my interface names have
been stable ever since.
Considering all of the above, I'm not at all convinced that your method
works.
Björn Persson