[systemd-devel] Renaming interfaces with systemd.link
Chris Trobridge
christrobridge at hotmail.com
Sat Apr 1 20:45:44 UTC 2017
> From: Lennart Poettering <lennart at poettering.net>
> Sent: 30 March 2017 16:15
> To: Chris Trobridge
> Cc: systemd-devel at freedesktop.org
> Subject: Re: [systemd-devel] Renaming interfaces with systemd.link
>
> On Tue, 14.03.17 19:18, Chris Trobridge (christrobridge at hotmail.com) wrote:
>
> >
> > On Fedora 25 I can rename a tap interface with a .link file in
> > /etc/systemd/network but I cannot rename any Ethernet interfaces.
>
> It should work for all interfaces.
>
> My educated guess is that your .link file was ignored due to the
> existance of /usr/lib/systemd/network/99-default.link. Make sure to
> prefix your .link file with some number < 99 to ensure it takes
> precedence.
>
> Lennart
Thanks Lennart,
This isn't the issue - I prefix all my config files with 10-
The problem seems to be the matching on eth0.
If I put "OriginalName=eth0" or "MACAddress=08:00:27:57:f6:40" in the .link file then renaming in the [Link] section has no effect, with no reference to the renamed address in dmesg.
If I comment out the match conditions then the renaming is applied to another interface (presumably the first one to be considered?).
$ dmesg | grep eno1
[ 8.813370] eno1: renamed from virbr0-nic
So either I have specified the match clauses incorrectly (it appears to me to follow the man page example) or there is an issue matching eth0.
As mentioned before, I did find some discussion about the .link configuration needing to be copied into initramfs to have an effect. This makes some sense to me as you cannot rename an interface twice so if eth0 has been renamed but the bridge (in my example below) wasn't renamed then it could still be renamed here.
But that would also imply renaming was occurring at two points in the boot process, which is not something I am aware of.
For reference:
$cat /etc/systemd/network/10-eth0.link
[Match]
#OriginalName=eth0
MACAddress=08:00:27:57:f6:40
[Link]
Name=eno1
$ dmesg | grep eth0
[ 1.636915] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:57:f6:40
[ 1.636920] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.637818] e1000 0000:00:03.0 enp0s3: renamed from eth0
For these tests I have been using Fedora 25 in VirtualBox.
Regards,
Chris
More information about the systemd-devel
mailing list