diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh index a05c469808..0dc9541c8b 100755 --- a/modules.d/35network-legacy/ifup.sh +++ b/modules.d/35network-legacy/ifup.sh @@ -446,7 +446,11 @@ for p in $(getargs ip=); do # If this option isn't directed at our interface, skip it if [ -n "$dev" ]; then - [ "$dev" != "$netif" ] && continue + if [ "$dev" != "$netif" ]; then + [ ! -e "/sys/class/net/$dev" ] \ + && warn "Network interface '$dev' does not exist!" + continue + fi else iface_is_enslaved "$netif" && continue fi diff --git a/modules.d/35network-legacy/parse-ip-opts.sh b/modules.d/35network-legacy/parse-ip-opts.sh index 35917bbfbc..19af878965 100755 --- a/modules.d/35network-legacy/parse-ip-opts.sh +++ b/modules.d/35network-legacy/parse-ip-opts.sh @@ -97,6 +97,11 @@ for p in $(getargs ip=); do fi # IFACES list for later use IFACES="$IFACES $dev" + + # Interface should exist + if [ ! -e "/sys/class/net/$dev" ]; then + warn "Network interface '$dev' does not exist" + fi fi # Do we need to check for specific options? diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh index 5f71515ac7..345863f995 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -103,6 +103,11 @@ interface_bind() { local _netif="$1" local _macaddr="$2" + if [ ! -e "/sys/class/net/$_netif" ]; then + derror "Cannot find network interface '$_netif'!" + return 1 + fi + # see, if we can bind it to some hw parms if hw_bind "$_netif" "$_macaddr"; then # only print out DEVICE, if it's user assigned