diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 1f0b9a7a187..2b99c5b6cf3 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -390,7 +390,28 @@ setup_common() { then ip route add default via $GW dev eth0 else - ip route add default via $GW dev $3 + timer=0 + #default route add fails if we run before interface configured with ip + while true + do + ip=$(ifconfig $3 | grep "inet addr:" | awk '{print $2}' | awk -F: '{print $2}') + if [ -z $ip ] + then + sleep 1; + #waiting for the interface to setup with ip + echo "waiting for $3 interface setup with ip" + else + ip route add default via $GW dev $3 + break + fi + + if [ $timer -gt 5 ] + then + echo "interface $3 is not set up with ip... configuring default route failed" + break + fi + timer=`expr $timer + 1` + done fi fi