You are not logged in.

#1 2013-01-16 03:54:28

Beelzebud
Member
From: Illinois, U.S.
Registered: 2010-07-16
Posts: 154

Persistent network names in systmd 197

Just curious about something.   udev already had a network naming scheme.   You would save your id's to a file called "/etc/udev/rules.d/10-network.rules".  Will that file still work, or do I need to rename it to "70-my-net-names.rules"? 

It just seems rather pointless to move configs around like this, when the function was already there to begin with.  I guess I'm missing the point.

Offline

#2 2013-01-16 05:05:48

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

You probably have a ruleset based on MAC or driver. The new scheme is supposed to provide a quasi-persistent naming without additional configuration. The rule responsible for renaming is included in /usr/lib/udev/rules.d/80-net-name-slot.rules and is masked on update by the corresponding empty file in /etc/udev/rules.d.

So, of your custom ruleset is 10-network.rules, it will be loaded first, 80-net-name-slot.rules will be ignored, and you'll have the naming convention which you wanted originally. However, if you remove /etc/udev/rules.d/80-net-name-slot.rules, you'll need to rename 10-xxx to 81-xxx (something whose name starts from an integer >80). Otherwise, your rules will be reverted by the stock udev config...


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#3 2013-01-16 05:13:52

Beelzebud
Member
From: Illinois, U.S.
Registered: 2010-07-16
Posts: 154

Re: Persistent network names in systmd 197

Ok that's what i assumed, but wanted to be sure I was correct.  I went ahead and just renamed my original file to 70-blahblah, and rebooted and it seems to be working fine.   

Thanks for the information.

Offline

#4 2013-01-16 06:39:33

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,088
Website

Re: Persistent network names in systmd 197

Doubtless this thread will grow over the coming days, so I'll get in early...


The deprecated interface name eth0 is hardcoded into /usr/lib/systemd/system/dhcpcd@service, I changed it to read:

Alias=multi-user.target.wants/dhcpcd@enp2s0.service

and then re-enabled it to symlink it to the correct file in /etc -- but that seems horribly hackish; is it necessary and/or advisable?
It does bring up the correct interface at boot.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#5 2013-01-16 22:18:09

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

jasonwryan wrote:

Doubtless this thread will grow over the coming days, so I'll get in early...


The deprecated interface name eth0 is hardcoded into /usr/lib/systemd/system/dhcpcd@service, I changed it to read:

Alias=multi-user.target.wants/dhcpcd@enp2s0.service

and then re-enabled it to symlink it to the correct file in /etc -- but that seems horribly hackish; is it necessary and/or advisable?
It does bring up the correct interface at boot.

I don't think so because "Alias=" will be used when you enable dhcpcd@.service without anything after "@". It is like getty@.service which is by default getty@tty1.service, but you can also symlink getty@tty57.service to getty@.service.

Similarly, the proper way of doing things is to leave dhcpcd@.service intact and have dhcpcd@<iface name>.service  symlinked to it. Of course, by "proper" I mean from systemd perspective, not necessarily from networking point of view.

Last edited by Leonid.I (2013-01-16 22:19:40)


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#6 2013-01-16 22:58:38

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,088
Website

Re: Persistent network names in systmd 197

Leonid.I wrote:
jasonwryan wrote:

Doubtless this thread will grow over the coming days, so I'll get in early...


The deprecated interface name eth0 is hardcoded into /usr/lib/systemd/system/dhcpcd@service, I changed it to read:

Alias=multi-user.target.wants/dhcpcd@enp2s0.service

and then re-enabled it to symlink it to the correct file in /etc -- but that seems horribly hackish; is it necessary and/or advisable?
It does bring up the correct interface at boot.

I don't think so because "Alias=" will be used when you enable dhcpcd@.service without anything after "@". It is like getty@.service which is by default getty@tty1.service, but you can also symlink getty@tty57.service to getty@.service.

Similarly, the proper way of doing things is to leave dhcpcd@.service intact and have dhcpcd@<iface name>.service  symlinked to it. Of course, by "proper" I mean from systemd perspective, not necessarily from networking point of view.

Thanks: I had wondered about that. But as the symlink to /etc/ was explicitly called dhcpcd@eth0, I figured that would just impede proper loading at boot.

It also strikes me as odd that the deprecated interface name is hardcoded... so the symlink has to inherit that name, doesn't it?


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#7 2013-01-17 01:01:49

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

jasonwryan wrote:
Leonid.I wrote:
jasonwryan wrote:

Doubtless this thread will grow over the coming days, so I'll get in early...


The deprecated interface name eth0 is hardcoded into /usr/lib/systemd/system/dhcpcd@service, I changed it to read:

Alias=multi-user.target.wants/dhcpcd@enp2s0.service

and then re-enabled it to symlink it to the correct file in /etc -- but that seems horribly hackish; is it necessary and/or advisable?
It does bring up the correct interface at boot.

I don't think so because "Alias=" will be used when you enable dhcpcd@.service without anything after "@". It is like getty@.service which is by default getty@tty1.service, but you can also symlink getty@tty57.service to getty@.service.

Similarly, the proper way of doing things is to leave dhcpcd@.service intact and have dhcpcd@<iface name>.service  symlinked to it. Of course, by "proper" I mean from systemd perspective, not necessarily from networking point of view.

Thanks: I had wondered about that. But as the symlink to /etc/ was explicitly called dhcpcd@eth0, I figured that would just impede proper loading at boot.

It also strikes me as odd that the deprecated interface name is hardcoded... so the symlink has to inherit that name, doesn't it?


Right, the symlink had to be replaced with one including a correct interface name, e.g. "dhcpcd@wlp2s0f0.service". However, there is no need to change dhcpcd@.service in /usr/lib (or mask it with a file in /etc) because eth0 will be replaced with the above interface name.

Also, nothing got deprecated with udev 197. The naming convention has changed from one arbitrary scheme to another.  But names based on ID_NET_NAME_PATH existed before.

My personal opinion is that this move is irrelevant for anything practical because people who want really persistent naming usually use MAC or ID_NET_NAME_MAC, and folks with single wifi/eth cards (e.g. laptop) do not need new names anyway.


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#8 2013-01-17 01:18:22

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,088
Website

Re: Persistent network names in systmd 197

Leonid.I wrote:
jasonwryan wrote:

Thanks: I had wondered about that. But as the symlink to /etc/ was explicitly called dhcpcd@eth0, I figured that would just impede proper loading at boot.

It also strikes me as odd that the deprecated interface name is hardcoded... so the symlink has to inherit that name, doesn't it?


Right, the symlink had to be replaced with one including a correct interface name, e.g. "dhcpcd@wlp2s0f0.service". However, there is no need to change dhcpcd@.service in /usr/lib (or mask it with a file in /etc) because eth0 will be replaced with the above interface name.

Ah; I hadn't thought to experiment and just let it boot like that: I changed it before rebooting.

Leonid.i wrote:

Also, nothing got deprecated with udev 197. The naming convention has changed from one arbitrary scheme to another.  But names based on ID_NET_NAME_PATH existed before.

My personal opinion is that this move is irrelevant for anything practical because people who want really persistent naming usually use MAC or ID_NET_NAME_MAC, and folks with single wifi/eth cards (e.g. laptop) do not need new names anyway.

Thank you for clarifying this. It's good to know we are swapping arbitrary for arbitrary smile


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#9 2013-01-17 01:41:15

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: Persistent network names in systmd 197

Beelzebud wrote:

Just curious about something.   udev already had a network naming scheme.   You would save your id's to a file called "/etc/udev/rules.d/10-network.rules".  Will that file still work, or do I need to rename it to "70-my-net-names.rules"? 

It just seems rather pointless to move configs around like this, when the function was already there to begin with.  I guess I'm missing the point.

If by "id's" you mean mac addresses, then you're incorrect that a reliable and persistent naming scheme existed in udev before this. Plenty of machines exist where the MAC address for multiple interfaces is identical. There needed to be a better way of uniquely and reliably identifying an interface which is what systemd 197 introduced. The new rules generally end up naming interfaces by their location on the bus. This scheme is bounded by the laws of physics until you can figure out how to connect 2 network cards to the same PCI address.

All your answers are below, particularly in the first bullet point:

https://mailman.archlinux.org/pipermail … 24231.html

Offline

#10 2013-01-17 01:56:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: Persistent network names in systmd 197

Is it recommended to switch to the new scheme? Or is it fine to leave it masked? Since I've never had to worry about this stuff before, I am hoping for the second but if that's going to cause issues down the line, I'd prefer to prepare now.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#11 2013-01-17 02:19:44

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: Persistent network names in systmd 197

I wrote:

*** I don't like this, or, I've never needed persistent names

You'll never be forced to use the new schema. Masking the rule as
explained above will always work, and you're still able to write a rule
of your own to provide names you're comfortable with if that's what
you're into.

We enable it for new installs because that's what upstream does.

Last edited by falconindy (2013-01-17 02:20:16)

Offline

#12 2013-01-17 03:19:11

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

jasonwryan wrote:

Ah; I hadn't thought to experiment and just let it boot like that: I changed it before rebooting.

Leonid.i wrote:

Also, nothing got deprecated with udev 197. The naming convention has changed from one arbitrary scheme to another.  But names based on ID_NET_NAME_PATH existed before.

My personal opinion is that this move is irrelevant for anything practical because people who want really persistent naming usually use MAC or ID_NET_NAME_MAC, and folks with single wifi/eth cards (e.g. laptop) do not need new names anyway.

Thank you for clarifying this. It's good to know we are swapping arbitrary for arbitrary smile

To give due credit, I'd say from arbitrary to less arbitrary. One advantage of the latter is persistence, so users who don't know about udev won't get their NICs confused. However, I find it more convenient to instruct udev to setup mnemonic names, like "external.nic".

Of course, there is always a question whether you want to identify a card based on its properties, like ID_NET_NAME_MAC, or based on its place on e.g. PCI bus (ID_NET_NAME_PATH). In the end it might be a matter of semantics...


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#13 2013-01-17 03:47:04

dbb
Member
From: New York City
Registered: 2008-12-14
Posts: 30
Website

Re: Persistent network names in systmd 197

Leonid.I wrote:

I don't think so because "Alias=" will be used when you enable dhcpcd@.service without anything after "@".

Strange, on my system running:

# systemctl enable dhcpcd@<ANYTHING>.service

Always creates a symlink to whatever the Alias value is. So by default it always does:

ln -s '/usr/lib/systemd/system/dhcpcd@.service' '/etc/systemd/system/multi-user.target.wants/dhcpcd@eth0.service'

If I change Alias to be something else, it will create the link to that. It's as if it's just ignoring what's after the @ on the command line.

Starting the service though, will work as expected:

# systemctl start dhcpcd@enp2s0.service

And run dhcpcd on the correct interface.

EDIT: Apparently because of https://bugs.freedesktop.org/show_bug.cgi?id=53954

Last edited by dbb (2013-01-17 12:59:42)

Offline

#14 2013-01-17 04:44:36

Beelzebud
Member
From: Illinois, U.S.
Registered: 2010-07-16
Posts: 154

Re: Persistent network names in systmd 197

falconindy wrote:
Beelzebud wrote:

Just curious about something.   udev already had a network naming scheme.   You would save your id's to a file called "/etc/udev/rules.d/10-network.rules".  Will that file still work, or do I need to rename it to "70-my-net-names.rules"? 

It just seems rather pointless to move configs around like this, when the function was already there to begin with.  I guess I'm missing the point.

If by "id's" you mean mac addresses, then you're incorrect that a reliable and persistent naming scheme existed in udev before this. Plenty of machines exist where the MAC address for multiple interfaces is identical. There needed to be a better way of uniquely and reliably identifying an interface which is what systemd 197 introduced. The new rules generally end up naming interfaces by their location on the bus. This scheme is bounded by the laws of physics until you can figure out how to connect 2 network cards to the same PCI address.

All your answers are below, particularly in the first bullet point:

https://mailman.archlinux.org/pipermail … 24231.html

Yes I meant the MAC addresses.   At any rate here is what is in my "70-my-net-names.rules" file:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0e:a6:7a:9f:8c", NAME="net0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0e:a6:68:1b:6a", NAME="net1"

I've booted a few times and it has worked correctly each time.  I didn't realize some machines had cards with identical MAC addresses, so that goes a long way to understanding the rationale for the change.   Thanks for the info.

Offline

#15 2013-01-18 17:44:49

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 300

Re: Persistent network names in systmd 197

Is it really necessary to rename "10-network.rules" to "70-my-net-names.rules". The last section in this link: http://www.freedesktop.org/wiki/Softwar … rfaceNames merely suggests calling it 70-my-net-names.rules, and only states that the numeric prefix must be lower than 80? Or am I not reading this right?

Offline

#16 2013-01-18 19:47:56

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,088
Website

Re: Persistent network names in systmd 197

<80 is the requirement. Should be easy enough to test.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#17 2013-01-18 20:13:56

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 300

Re: Persistent network names in systmd 197

Yes: 10-network-rules.conf works just fine. But OP renamed it to 70. If 70 is the new standard, we should update the Wiki on this. If not, let's not bother with any changes, since the old way works just fine.

Offline

#18 2013-01-18 20:20:53

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,088
Website

Re: Persistent network names in systmd 197

twelveeighty wrote:

Yes: 10-network-rules.conf works just fine. But OP renamed it to 70. If 70 is the new standard, we should update the Wiki on this. If not, let's not bother with any changes, since the old way works just fine.

I'm obviously missing something here: you can rename it to anything you like, as long as it is less than 80. What needs updating in the wiki?


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#19 2013-01-18 21:14:06

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

jasonwryan wrote:
twelveeighty wrote:

Yes: 10-network-rules.conf works just fine. But OP renamed it to 70. If 70 is the new standard, we should update the Wiki on this. If not, let's not bother with any changes, since the old way works just fine.

I'm obviously missing something here: you can rename it to anything you like, as long as it is less than 80. What needs updating in the wiki?

Why less than 80? AFAIU rules are processed in lexical order, so 10-xxx.rules is processed before 20-yyy.rules. If you have a file 70-network.rules which touches interfaces, then won't 80-net-name-slot.rules change them? I'd say, user-defined interface names should come in effect after kernel/udev are done with the defaults...

Last edited by Leonid.I (2013-01-18 21:14:45)


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#20 2013-01-18 21:14:12

chris_l
Member
Registered: 2010-12-01
Posts: 387

Re: Persistent network names in systmd 197

jasonwryan wrote:
twelveeighty wrote:

Yes: 10-network-rules.conf works just fine. But OP renamed it to 70. If 70 is the new standard, we should update the Wiki on this. If not, let's not bother with any changes, since the old way works just fine.

I'm obviously missing something here: you can rename it to anything you like, as long as it is less than 80. What needs updating in the wiki?

Thats the part you are missing. He thinks it has to be 70 for being standard and therefore he wants to update the wiki saying that it has to be 70.

@twelveeighty: no, it has to be <80 only; 70 is fine, 10 is fine.


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#21 2013-01-18 21:15:40

chris_l
Member
Registered: 2010-12-01
Posts: 387

Re: Persistent network names in systmd 197

Leonid.I wrote:

Why less than 80? AFAIU rules are processed in lexical order, so 10-xxx.rules is processed before 20-yyy.rules. If you have a file 70-network.rules which touches interfaces, then won't 80-net-name-slot.rules change them? I'd say, user-defined interface names should come in effect after kernel/udev are done with the defaults...

The number is the priority.


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#22 2013-01-18 21:45:26

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: Persistent network names in systmd 197

chris_l wrote:
Leonid.I wrote:

Why less than 80? AFAIU rules are processed in lexical order, so 10-xxx.rules is processed before 20-yyy.rules. If you have a file 70-network.rules which touches interfaces, then won't 80-net-name-slot.rules change them? I'd say, user-defined interface names should come in effect after kernel/udev are done with the defaults...

The number is the priority.

Where is that coming from?

Even w/o looking at the udev manpage, if you read the above-mentioned freedesktop wiki which suggests using the name 70-xxx.rules, it says that this rule will be processed BEFORE 80-yyy.rules. The only reason why the latter will be ineffective is because it contains a check for non-empty NAME and quits if NAME has already been set. It seems to me that an error in this logic will destroy your naming convention...


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#23 2013-01-18 22:39:16

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: Persistent network names in systmd 197

Udev rules are processed in lexical order. 70* is lexically less than 80*.

Offline

#24 2013-01-18 23:21:52

chris_l
Member
Registered: 2010-12-01
Posts: 387

Re: Persistent network names in systmd 197

my bad
^_^


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

Board footer

Powered by FluxBB