[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Patch] Support predictable network interface names



Attached please find the patches to support predictable network
interface names [1].
For PXE network booting, the original components only search for NIC
name as "eth*", however, Debian Sid has used systemd/udev >= v197 for a
few weeks and now by default the NIC name is started with "en", like
"eno1677736".
My 2 cents.
Thanks.

[1]
http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

Steven.
-- 
Steven Shiau <steven _at_ stevenshiau org>
Public Key Server PGP Key ID: 4096R/47CF935C
Fingerprint: 0240 1FEB 695D 7112 62F0  8796 11C1 12DA 47CF 935C
--- components/9990-netbase.sh	2015-05-05 01:52:02.000000000 +0800
+++ components/9990-netbase.sh.new	2015-08-18 09:58:52.358134189 +0800
@@ -93,7 +93,7 @@
 		# iterate the physical interfaces and add them to the interfaces list and also add when ethdevice= called on cmdline
 		if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ]) || [ ! -z "${ETHDEVICE}" ]
 		then
-			for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
+			for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan* /sys/class/net/en*
 			do
 				[ -e ${interface} ] || continue
 				i="$(basename ${interface})"
--- components/9990-select-eth-device.sh	2015-05-05 01:52:02.000000000 +0800
+++ components/9990-select-eth-device.sh.new	2015-08-18 10:01:49.803300509 +0800
@@ -39,7 +39,7 @@
 		echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?"
 		while [ -z "$l_interfaces" ]
 		do
-			l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)"
+			l_interfaces="$(cd /sys/class/net/ && ls -d * 2>/dev/null | grep -v "lo")"
 		done
 
 		if [ $(echo $l_interfaces | wc -w) -lt 2 ]

Reply to: