[systemd-devel] [systemd.link] How to use NamePolicy=mac?
Moviuro
moviuro at gmail.com
Wed Oct 8 01:04:03 PDT 2014
Hi all!
In order to fix in an easily predictable manner the interfaces' names, I went
and wrote the following .link file:
/etc/systemd/network/00-default.link
[Link]
NamePolicy=mac
MACAddressPolicy=persistent
I daemon-reload, reboot:
$ ip a
[...]
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
group default qlen 1000
link/ether b8:27:eb:aa:aa:d2 brd ff:ff:ff:ff:ff:ff
[...]
[...]
However,
$ udevadm test-builtin net_setup_link /sys/class/net/eth0
calling: test-builtin
load module index
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /etc/systemd/network/00-default.link
Created link configuration context.
ID_NET_DRIVER=smsc95xx
Config file /etc/systemd/network/00-default.link applies to device eth0
ID_NET_NAME=enxb827ebaaaad2
unload module index
Unloaded link configuration context.
Also,
# /lib/systemd/systemd-udevd --debug
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram9'
restoring old watch on '/dev/ram9'
adding watch on '/dev/ram9'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram8'
restoring old watch on '/dev/ram8'
adding watch on '/dev/ram8'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram7'
restoring old watch on '/dev/ram7'
adding watch on '/dev/ram7'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram5'
restoring old watch on '/dev/ram5'
adding watch on '/dev/ram5'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram14'
restoring old watch on '/dev/ram14'
adding watch on '/dev/ram14'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram2'
restoring old watch on '/dev/ram2'
adding watch on '/dev/ram2'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram15'
restoring old watch on '/dev/ram15'
adding watch on '/dev/ram15'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram6'
restoring old watch on '/dev/ram6'
adding watch on '/dev/ram6'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram4'
restoring old watch on '/dev/ram4'
adding watch on '/dev/ram4'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram3'
restoring old watch on '/dev/ram3'
adding watch on '/dev/ram3'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram13'
restoring old watch on '/dev/ram13'
adding watch on '/dev/ram13'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram11'
restoring old watch on '/dev/ram11'
adding watch on '/dev/ram11'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop6'
restoring old watch on '/dev/loop6'
adding watch on '/dev/loop6'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram12'
restoring old watch on '/dev/ram12'
adding watch on '/dev/ram12'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop3'
restoring old watch on '/dev/loop3'
adding watch on '/dev/loop3'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop5'
restoring old watch on '/dev/loop5'
adding watch on '/dev/loop5'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram1'
restoring old watch on '/dev/ram1'
adding watch on '/dev/ram1'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram0'
restoring old watch on '/dev/ram0'
adding watch on '/dev/ram0'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop7'
restoring old watch on '/dev/loop7'
adding watch on '/dev/loop7'
device 0xb78bb3f8 has devpath '/devices/virtual/block/ram10'
restoring old watch on '/dev/ram10'
adding watch on '/dev/ram10'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop1'
restoring old watch on '/dev/loop1'
adding watch on '/dev/loop1'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop2'
restoring old watch on '/dev/loop2'
adding watch on '/dev/loop2'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop4'
restoring old watch on '/dev/loop4'
adding watch on '/dev/loop4'
device 0xb78bb3f8 has devpath '/devices/virtual/block/loop0'
restoring old watch on '/dev/loop0'
adding watch on '/dev/loop0'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p2'
restoring old watch on '/dev/mmcblk0p2'
adding watch on '/dev/mmcblk0p2'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0/mmcblk0p1'
restoring old watch on '/dev/mmcblk0p1'
adding watch on '/dev/mmcblk0p1'
device 0xb78bb3f8 has devpath '/devices/platform/mmc-
bcm2835.0/mmc_host/mmc0/mmc0:59b4/block/mmcblk0'
restoring old watch on '/dev/mmcblk0'
adding watch on '/dev/mmcblk0'
=== trie on-disk ===
tool version: 216
file size: 6486785 bytes
header size 80 bytes
strings 1673705 bytes
nodes 4813000 bytes
load module index
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /etc/systemd/network/00-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
timestamp of '/usr/lib/udev/rules.d' changed
Reading rules file: /usr/lib/udev/rules.d/10-dm.rules
Reading rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
Reading rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
Reading rules file: /usr/lib/udev/rules.d/42-usb-hid-pm.rules
Reading rules file: /usr/lib/udev/rules.d/50-firmware.rules
Reading rules file: /usr/lib/udev/rules.d/50-udev-default.rules
Reading rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /usr/lib/udev/rules.d/60-drm.rules
Reading rules file: /usr/lib/udev/rules.d/60-keyboard.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-serial.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /usr/lib/udev/rules.d/61-accelerometer.rules
Reading rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
Reading rules file: /usr/lib/udev/rules.d/64-btrfs.rules
Reading rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
Reading rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Reading rules file: /usr/lib/udev/rules.d/70-power-switch.rules
Reading rules file: /usr/lib/udev/rules.d/70-uaccess.rules
Reading rules file: /usr/lib/udev/rules.d/71-seat.rules
Reading rules file: /usr/lib/udev/rules.d/73-seat-late.rules
Reading rules file: /usr/lib/udev/rules.d/75-net-description.rules
Reading rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /usr/lib/udev/rules.d/75-tty-description.rules
Reading rules file: /usr/lib/udev/rules.d/78-sound-card.rules
Reading rules file: /usr/lib/udev/rules.d/80-drivers.rules
Reading rules file: /usr/lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /usr/lib/udev/rules.d/95-udev-late.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
Reading rules file: /etc/udev/rules.d/raspberrypi.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 11452 bytes strings
1734 strings (21255 bytes), 1151 de-duplicated (10387 bytes), 584 trie nodes
used
set children_max to 10
^Cvalidate module index
Check if link configuration needs reloading.
unload module index
Unloaded link configuration context.
So question: how can I use the given ID_NET_NAME and get rid at vitam eternam
of 'eth0'?
This would be useful for services that require an interface name (e.g.
Wpa_supplicant).
The behavior is the same on my laptop (eth0 instead of enx<mac>; wlan0 instead
of wlx<mac>); however, I don't have the output of the last commands to share.
Best regards,
--
Moviuro @ PsychoticDelirium
"Our life is the immortals' death."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141008/e45f6af1/attachment.sig>
More information about the systemd-devel
mailing list