--- a/snippets/post_install_network_config
+++ a/snippets/post_install_network_config
@@ -147,7 +147,7 @@ fi
#if $configbymac and $is_vlan == "false" and $bonding.lower() != "master"
## This is the code path physical interfaces will follow.
## Get the current interface name
-IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1)
+IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
## Rename this interface in modprobe.conf
## FIXME: if both interfaces startwith eth this is wrong
if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then
--- a/snippets/pre_install_network_config
+++ a/snippets/pre_install_network_config
@@ -1,5 +1,27 @@
#if $getVar("system_name","") != ""
# Start pre_install_network_config generated code
+#raw
+# generic functions to be used later for discovering NICs
+mac_exists() {
+ if which ip &> /dev/null; then
+ ip -o link | grep -i "$1" &> /dev/null
+ return $?
+ else
+ ifconfig -a | grep -i "$1" &> /dev/null
+ return $?
+ fi
+}
+get_ifname() {
+ if which ip &> /dev/null; then
+ IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
+ else
+ IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
+ if [ -z $IFNAME ]; then
+ IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
+ fi
+ fi
+}
+#end raw
#set ikeys = $interfaces.keys()
#import re
#set $vlanpattern = $re.compile("[a-zA-Z0-9]+[\.:][0-9]+")
@@ -75,9 +97,9 @@
#set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname)
#end if
# Configuring $iname ($mac)
-if ifconfig -a | grep -i $mac
+if mac_exists $mac
then
- IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1)
+ get_ifname $mac
echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config
fi
#else