Network interface names

Carsten Aulbert carsten.aulbert at aei.mpg.de
Sat Oct 13 08:04:12 CEST 2018


Hi Steffen,

On 10/12/18 17:09, Steffen Grunewald wrote:
> I've learned that I may "fix" the device interface names using a rules file
> in /etc/udev/rules.d, to avoid susprises after the installation.
> While adding some special parameters to the kernel command line didn't work,
> udev does its job reliably outside of FAI.
> What I still haven't found is which magic FAI uses to avoid the renaming
> to "predictable network interface names" (a term that's completely misleading
> to me as I'm unable to predict the network names if I'm given a brand-new
> machine). Thomas, can you shed some light on this?
> My plan is to read the (old-style) interface names assigned by FAI, then
> create a $target/etc/udev/rules.d/70-persistent-net.rules file from that
> information. Is there a hidden trap? When is it best to write that file?

Maybe not 100% of what you want, but udevadm could help a bit (look for
subsystem 'net'):

udevadm info -e

[...]
P: /devices/pci0000:00/0000:00:02.0/0000:02:00.0/net/eth0
E: DEVPATH=/devices/pci0000:00/0000:00:02.0/0000:02:00.0/net/eth0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I350 Gigabit Network Connection
E: ID_MODEL_ID=0x1521
E: ID_NET_DRIVER=igb
E: ID_NET_NAME_MAC=enx487b6b3b30bc
E: ID_NET_NAME_PATH=enp2s0f0
E: ID_PATH=pci-0000:02:00.0
E: ID_PATH_TAG=pci-0000_02_00_0
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_VENDOR_ID=0x8086
E: IFINDEX=2
E: INTERFACE=eth0
E: SUBSYSTEM=net
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/eth0
E: TAGS=:systemd:
E: USEC_INITIALIZED=5637

i.e. on this jessie host, this NIC is still named eth0, but in stretch
would get the predictable name of enp2s0f0 unless overridden by udev.

By parsing this output via a hook, one should be able to create the
rules and rename the interfaces if wanted.

Does this help?

cheers

Carsten

-- 
Dr. Carsten Aulbert, Max Planck Institute for Gravitational Physics,
Callinstraße 38, 30167 Hannover, Germany
Phone: +49 511 762 17185


More information about the linux-fai mailing list