Not-so-predictable network names

Ian Kelling ian at iankelling.org
Tue Aug 9 23:12:13 CEST 2016



On Thu, Aug 4, 2016, at 08:52 AM, andrew bezella wrote:
> 
> why slot and not port: 
> > Working from top to bottom, udev takes the first match of:
> > 
> > * ID_NET_NAME_FROM_DATABASE
> > * ID_NET_NAME_ONBOARD
> > * ID_NET_NAME_SLOT
> > * ID_NET_NAME_PATH
> > * ID_NET_NAME_MAC
> 
> cf.
> https://major.io/2015/08/21/understanding-systemds-predictable-network-device-names/
> 
> hth...

Yes, I'm following this path. At the top of 30-interface, I have a
condition
for if the os is in a class that uses a persistent name, and inside
I have this code:

    for field in ID_NET_NAME_FROM_DATABASE \
                     ID_NET_NAME_ONBOARD \
                     ID_NET_NAME_SLOT \
                     ID_NET_NAME_PATH \
                     ID_NET_NAME_MAC; do
        name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E:
        $field=(.+)/\1/p")
        if [[ $name ]]; then
            NIC1=$name
            break
        fi
    done
    if [[ ! $name ]]; then
        echo "$0: error: could not find systemd predictable network
        name"
        exit 1
    fi



More information about the linux-fai mailing list