2

System is Ubuntu 16.10. It has been updated quite some times, so it might have some remaining stuff from earlier versions in there (at least back till 14.04, probably much longer).

The issue it the following: I have two network interfaces in the system (on mainboard). One was always named eth0. The second was not in use. Now I have a new situation in my network and want to use the second interface.

I learned a lot about interface rename and the new rename rules. So the second interface choses the name enp5s0 or similar, can't remember, therefore I need to rename it. But here is where my trouble starts.

eth0 was handled in /etc/udev/rules.d/70-persistent-net.rules which, I learned, is deprecated. I tried to add a second rule for "eth1" there (using its mac instead the one of eth0), but it did not work.

So after reading a bit I got rid of the old file and maybe I misunderstood something, but I figured eth* names are discouraged today, so I've chosen to call them lan0 and lan1 (which describes what they will be used for). Then I added new files in /etc/systemd/network:

10-eth-lan0.link
10-eth-lan1.link

With this content:

[Match]
MACAddress=00:23:54:96:74:07/06

[Link]
Name=lan0/1

for the different MACAddresses and the different names. For eth0 this seems to work, for eth1 (or whatever reason) it does not. And I am quite puzzled why the heck it won't work. I tripple checked the mac.

dmesg | grep eth shows me this:

[    6.233684] sky2 0000:08:00.0 eth0: addr 00:23:54:96:74:07
[    6.233975] sky2 0000:05:00.0 eth1: addr 00:23:54:96:74:06
[    6.661954] sky2 0000:08:00.0 lan0: renamed from eth0
[    8.513836] sky2 0000:05:00.0 rename3: renamed from eth1

I have absolutely no clue why it settled for "rename3" now... I experimented a bit with ip link set name after I saw the systemd link file not working.

What puzzles me most is that it works for eth0 -> lan0 but not for eth1 -> lan1. What can I look into to find out why the rename is not working? Who is caching stuff here? The "ip link set name" did have some persistent effects (like the change to "rename3" from the enp5s0 or similar).

[edit] I recognized one more thing now: My loopback interface gets renamed to lan1. Don't know why. But it happens on every boot now. Also I got rid of the *.link files described above and the renames still happen just the same.... ??? In /etc there is now just one mention of lan0 in /etc/network/interfaces and no mention of lan1. Somebody stores that stuff somewhere and I don't know who or where.

  • Try removing 10-eth-lan0.link. If it now renames eth1, you have to dig deeper. If it doesn't rename eth1, there's probably a typo somewhere. – dirkt Feb 27 '17 at 7:48
  • I removed <code>10-eth-lan0.link</code> as you suggested and rebootet (is there a way to spare the reboot?). The situation did not change a bit. eth0 is still renamed to lan0 and eth1 to "rename3". Something seems to persist those renames, but I can't find out what. – Garfonso Feb 27 '17 at 14:30
  • So it's not systemd. (1) Remove the rule in 70-persistent-net.rules, (2) instead of removing, modify the rule for eth1, and see what happens in both cases. And update your question with the rules that were there/that you used. Also look at the file afterwards, it might change because some system program might write to it. I don't think you can skip the reboot, that will make tracking down the problem just harder (one more variable). – dirkt Feb 27 '17 at 15:40
  • There is no 70-persistent-net.rules on the system anymore, I removed it after reading it was deprecated. And I did add changes there before and tested them, which did not affect anything. Funny thing is, there are now no more files in /etc that tell the system to rename anything into lan0 or lan1 and eth0 still gets renamed to lan0 and eth1 to "rename3". – Garfonso Mar 1 '17 at 6:36
  • I guess you know have to look at all udev rules, and all of what systemd does, to find out which file was produced that causes this. Timestamps may help. I'm afraid this is impossible to debug for me without being able to see all what's on your system. – dirkt Mar 1 '17 at 6:42
0

(I know this is a RHEL document, but it's really just about udev)

Understanding the Device Renaming Procedure

  1. A rule in /usr/lib/udev/rules.d/60-net.rules instructs the udev helper utility, /lib/udev/rename_device, to look into all /etc/sysconfig/network-scripts/ifcfg-suffix files. If it finds an ifcfg file with a HWADDR entry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by the DEVICE directive.

So if you want the simplest method for renaming your device, create a file /etc/sysconfig/network-scripts/ifcfg-${INTERFACE_NAME} with at least the following:

DEVICE=${INTERFACE_NAME}
HWADDR=${MAC_ADDRESS}

So if your interface has a MAC of 00:11:22:33:44:55 and you wanted it to be called penguin-interface

/etc/sysconfig/network-scripts/ifcfg-penguin-interface

DEVICE=penguin-interface
HWADDR=00:11:22:33:44:55

You can use all the usual settings in there as well.


In case you're wondering how those names like enp5s0 happen (ethernet port 5 slot 0) https://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.