fix网卡bonding时获取主机IP错误

dev1
gjmzj 2019-06-24 23:09:26 +08:00
parent 0747945f9f
commit b66bedba9b
2 changed files with 2 additions and 2 deletions

View File

@ -304,7 +304,7 @@ function start-aio(){
if [[ -z $HOST_IP ]];then if [[ -z $HOST_IP ]];then
# easzctl runs in a host machine, get host's ip # easzctl runs in a host machine, get host's ip
HOST_IF=$(ip route|grep default|cut -d' ' -f5) HOST_IF=$(ip route|grep default|cut -d' ' -f5)
HOST_IP=$(ip a|grep $HOST_IF|awk 'NR==2{print $2}'|cut -d'/' -f1) HOST_IP=$(ip a|grep "$HOST_IF$"|awk '{print $2}'|cut -d'/' -f1)
fi fi
set -u set -u
cp -f $BASEPATH/example/hosts.allinone.example.en $BASEPATH/hosts cp -f $BASEPATH/example/hosts.allinone.example.en $BASEPATH/hosts

View File

@ -193,7 +193,7 @@ function start_kubeasz_docker() {
# get host's IP # get host's IP
host_if=$(ip route|grep default|cut -d' ' -f5) host_if=$(ip route|grep default|cut -d' ' -f5)
host_ip=$(ip a|grep "$host_if"|awk 'NR==2{print $2}'|cut -d'/' -f1) host_ip=$(ip a|grep "$host_if$"|awk '{print $2}'|cut -d'/' -f1)
echo "[INFO] get host IP: $host_ip" echo "[INFO] get host IP: $host_ip"
# run kubeasz docker container # run kubeasz docker container