udev / rules / 60-persistent-net.rules

# do not edit this file, it will be overwritten on update
#
# General idea: Set up ID_* entries in the udev db that can be looked up by the
# distro's network config later to find the right NIC device to configure. This
# is compatible with the persistent-net-generator rules if those are enabled.
#
# Find the NIC for a given attribute with something like:
# $(find-nic [ mac-{address} | path-{path specifier} | ethN ])
#
# where find-nic looks something like:
#
# #!/bin/bash
# # Accept real interfaces as well as identifiers
# if [ -e /sys/class/net/"${1}" ] ; then
#   echo "${1}"
#   exit 0
# fi
#
# id="${1#*-}"
#
# case "$1" in
#   mac-*)
#     for dev in /sys/class/net/* ; do
#       if /sbin/udevadm info -q env -p "$dev" | grep -q "ID_ADDRESS=${id}\$" ; then
#         echo "${dev##*/}"
#         exit 0
#       fi
#     done
#     exit 1
#     ;;
#   path-*)
#     for dev in /sys/class/net/* ; do
#       if /sbin/udevadm info -q env -p "$dev" | grep -q "ID_PATH=${id}\$" ; then
#         echo "${dev##*/}"
#         exit 0
#       fi
#     done
#     exit 1
#     ;;
#   *)
#     echo "Don't know how to dereference $1." >&2
#     exit 2
#     ;;
# esac

ACTION=="remove", GOTO="persistent_net_end"
SUBSYSTEM!="net", GOTO="persistent_net_end"

# Stash away the MAC address into the udev db
ENV{ID_ADDRESS}="$attr{address}"

# Grab a set of path-id exports as well
IMPORT{builtin}="path_id"

LABEL="persistent_net_end"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.