Discussion:
How to disable Predictable Network Interface Names using a drop-in?
Add Reply
Patrick Schleizer
2017-01-20 14:51:00 UTC
Reply
Permalink
Raw Message
Hi,

I've learned about the kernel parameter and symlink ways to disable
predictable network interface names. However, as a Debian derivative, it
would be much cleaner using a drop-in to disable it.

Is there some drop-in directory foo.service.d that can be used to
disable it?

Best regards,
Patrick
Brian Kroth
2017-01-21 05:04:02 UTC
Reply
Permalink
Raw Message
How about /etc/default/grub.d/ for the kernel parameter drop in file.
That's how I do it at least.

I don't think it's super well documented tho and I forget the suffix it
expects offhand (*.cfg?). Follow the chain of the update-grub scripts and
you should find it.

Cheers,
Brian

On Fri, Jan 20, 2017, 08:53 Patrick Schleizer <
Post by Patrick Schleizer
Hi,
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names. However, as a Debian derivative, it
would be much cleaner using a drop-in to disable it.
Is there some drop-in directory foo.service.d that can be used to
disable it?
Best regards,
Patrick
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Andrei Borzenkov
2017-01-21 06:13:33 UTC
Reply
Permalink
Raw Message
Post by Patrick Schleizer
Hi,
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names. However, as a Debian derivative, it
would be much cleaner using a drop-in to disable it.
Is there some drop-in directory foo.service.d that can be used to
disable it?
You may try to override 99-default.link with

[Link]
NamePolicy=

As I understand, having another file earlier in sorting order should do
it as well.

This should effectively disable name generation. Unfortunately, as
opposed to units, it is not possible to selectively override specific
key - first matching rule file is used entirely. This could lead to
missing changes in default link file on updates.
Lennart Poettering
2017-02-06 20:56:30 UTC
Reply
Permalink
Raw Message
Post by Patrick Schleizer
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names.
What would be the "symlink way"?
Linking the relevant .link file to /dev/null in /etc.
Will predictable network names still play nice with the old udev
way?
Well, if you have configuration, it's honoured.
I cannot make my brain remember that my notebook has enp0s25 and
wlp3s0, and would like to have eth0 and wlan0 again (or net0 and net1,
or wired0 and wless0, if it is a bad idea to move the interfaces back
to the kernel namespaces), while keeping the advantage of having
predictable network names for USB network interfaces that I regularly
plug in as well.
Will placing a /etc/udev/rules.d/70-persistent-network.rules
that renames enp0s25 to wired0 and wlp3s0 to wless0 play nice, it is
that asking for trouble?
Well, if you use names from the kernel's own namespace (i.e. ethXYZ or
wlanXYZ), yes, you#d be asking for trouble, since you#d be racing
against the kernel's naming.

However, if you pick your own names outside of the kernel's
namespaces, then all is good, and that's actually what we
recommend. (Though I'd do it by dropping in some .link files with the
right [Match] sections to make this happen, not bother with udev
rules, but either works)

Lennart
--
Lennart Poettering, Red Hat
Lennart Poettering
2017-02-20 16:38:10 UTC
Reply
Permalink
Raw Message
Post by Lennart Poettering
Post by Patrick Schleizer
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names.
What would be the "symlink way"?
Linking the relevant .link file to /dev/null in /etc.
What if there is no .link file and the Interfaces just come up as
enp8s0 and wlp2s0
We ship a default fallback .link file in systemd upstream:

/usr/lib/systemd/network/99-default.link

If your distro removes that, then I'd recommend contacting your distro
for help, as they are clearly deviating from upstream defaults, and I
have no idea where the naming is enforced then.
Post by Lennart Poettering
However, if you pick your own names outside of the kernel's
namespaces, then all is good, and that's actually what we
recommend. (Though I'd do it by dropping in some .link files with the
right [Match] sections to make this happen, not bother with udev
rules, but either works)
Consider naming the file 50-lanc0.link or so, so that it takes
precedence over 99-default.link if that's shipped by your distro. If
it isn't, please contact your downstream distro for help (see above).

Lennart
--
Lennart Poettering, Red Hat
Lennart Poettering
2017-02-20 16:42:19 UTC
Reply
Permalink
Raw Message
Post by Lennart Poettering
Post by Lennart Poettering
Post by Patrick Schleizer
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names.
What would be the "symlink way"?
Linking the relevant .link file to /dev/null in /etc.
What if there is no .link file and the Interfaces just come up as
enp8s0 and wlp2s0
/usr/lib/systemd/network/99-default.link
If your distro removes that, then I'd recommend contacting your distro
for help, as they are clearly deviating from upstream defaults, and I
have no idea where the naming is enforced then.
Post by Lennart Poettering
However, if you pick your own names outside of the kernel's
namespaces, then all is good, and that's actually what we
recommend. (Though I'd do it by dropping in some .link files with the
right [Match] sections to make this happen, not bother with udev
rules, but either works)
Consider naming the file 50-lanc0.link or so, so that it takes
precedence over 99-default.link if that's shipped by your distro. If
it isn't, please contact your downstream distro for help (see above).
BTW, all of the above is documented in systemd.link(5). My
recommendation is always to check the documentation first.

Lennart
--
Lennart Poettering, Red Hat
Lennart Poettering
2017-02-06 21:01:31 UTC
Reply
Permalink
Raw Message
Post by Patrick Schleizer
Hi,
I've learned about the kernel parameter and symlink ways to disable
predictable network interface names. However, as a Debian derivative, it
would be much cleaner using a drop-in to disable it.
Is there some drop-in directory foo.service.d that can be used to
disable it?
ln -s /dev/null /etc/systemd/network/99-default.link

Lennart
--
Lennart Poettering, Red Hat
Loading...