On 05/12/2016 11:36 AM, Lennart Poettering wrote:
On Thu, 12.05.16 11:20, Chris Friesen (cbf...@mail.usask.ca) wrote:

Hi,

Could someone point me to the commit that removed support for assigning
"ethX" names based on MAC addresses?

Alternately, can someone suggest a way to get equivalent behaviour (the
ability to set "ethX" names based on MAC address) using the current
infrastructure? (Preferably as of RHEL 7, so systemd 219 plus a bunch of
patches.)

The back story is that we've got a lot of scripts/tools that currently
assume the "ethX" naming, and while we will eventually sort it out we really
don't want to do it right now.  The previous method of assigning "ethX"
names was working well for our use-case (though I realize it had issues more
generally).

https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

See the end of that page.

I booted the kernel with "net.ifnames=0", which worked to turn off the location-based naming.

I then created a set of files, one per eth device that match based on MAC:

[root@compute-0 root]# cat /etc/systemd/network/10-eth
10-eth0.link  10-eth1.link  10-eth2.link  10-eth3.link


Here's an example of one of the files:

[root@compute-0 wrsroot]# cat /etc/systemd/network/10-eth0.link
[Match]
MACAddress=08:00:27:f1:36:11

[Link]
Name=eth0


When I booted up, however, the custom naming was not applied. Eth0 was a different device:

[root@compute-0 wrsroot]# ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 
1000
    link/ether 08:00:27:9f:b9:47 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 08:00:27:9d:14:c4 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 
1000
    link/ether 08:00:27:f1:36:11 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 
1000
    link/ether 08:00:27:dd:42:ae brd ff:ff:ff:ff:ff:ff



If I use some other set of names (vethX, for example) then the renaming works 
fine.

I tried removing "net.ifnames=0" from the kernel boot args, and got devices named like "enp0s3" even though I had /etc/systemd/network/10-ethX.link files for each device. This seems to contradict the information in https://www.freedesktop.org/software/systemd/man/systemd.link.html which says that the "Name=" should take effect if NamePolicy= is missing.

So I guess the question is, how do I rename a device to a name that already exists? (Like supposing I want to swap the names of eth0 and eth1.)

Chris

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to