diff --git a/nova/templates/bin/_nova-console-compute-init.sh.tpl b/nova/templates/bin/_nova-console-compute-init.sh.tpl index 212140f335..e672582793 100644 --- a/nova/templates/bin/_nova-console-compute-init.sh.tpl +++ b/nova/templates/bin/_nova-console-compute-init.sh.tpl @@ -32,8 +32,12 @@ fi if [ -z "${client_address}" ] ; then if [ -z "${client_interface}" ] ; then - # search for interface with default routing, if multiple default routes exist then select the one with the lowest metric. - client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }') + if [ -x "$(command -v route)" ] ; then + # search for interface with default routing, if multiple default routes exist then select the one with the lowest metric. + client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }') + else + client_interface=$(ip r | grep default | awk '{print $5}') + fi fi # determine client ip dynamically based on interface provided diff --git a/nova/templates/bin/_nova-console-proxy-init.sh.tpl b/nova/templates/bin/_nova-console-proxy-init.sh.tpl index 153e60d4b7..2b7e543e74 100644 --- a/nova/templates/bin/_nova-console-proxy-init.sh.tpl +++ b/nova/templates/bin/_nova-console-proxy-init.sh.tpl @@ -32,8 +32,12 @@ fi if [ -z "${client_address}" ] ; then if [ -z "${client_interface}" ] ; then - # search for interface with default routing, if multiple default routes exist then select the one with the lowest metric. - client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }') + if [ -x "$(command -v route)" ] ; then + # search for interface with default routing, if multiple default routes exist then select the one with the lowest metric. + client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }') + else + client_interface=$(ip r | grep default | awk '{print $5}') + fi fi # determine client ip dynamically based on interface provided