Skip to content

Fix persistent interface naming for Red hat 7.2 to 7.3 upgrade

Persistent interface naming in RHEL 7.3

RHEL 7.3 handels NIC names differently due to the new systemd implementation. The script below will help you prevent any issues when upgrading your VMware hosts from RHEL 7.2 to 7.3 where no prior patches are in place. This can happen for instance if you use image-based setup.

 

Implementation

You could run this script via a post-install script from your satellite or you could push this script via your orchestration tooling to your RHEL 7.2 machines that are already up and running.

 

The script

 

# Create udev rules for persistent interface names
# to prevent issues when upgrading from 7.2 to 7.3
# Based on Red Hat solution 2592561

. /etc/sysconfig/network-scripts/network-functions

RULES_FILE=”/etc/udev/rules.d/90-eno-fix.rules”

for i in /sys/class/net/eno* ; do
DEVICE=${i##*/}

[[ “$DEVICE” =~ eno[0-9]+(d[0-9]+)?$ ]] || continue
[ “$(echo $DEVICE | sed -e ‘s/eno\([0-9]\+\).*/\1/’)” -lt “16383” ] && continue

HWADDR=$(get_hwaddr $DEVICE | tr ‘[:upper:]’ ‘[:lower:]’)
[ -z “$HWADDR” ] && continue

echo “SUBSYSTEM==\”net\”, ACTION==\”add\”, DRIVERS==\”?*\”, ATTR{address}==\”$HWADDR\”, NAME=\”$DEVICE\”” >> “$RULES_FILE”
done