From 00556412a669f629f1b29a85586a91fedddcbad1 Mon Sep 17 00:00:00 2001 From: Vasily Pleshakov Date: Wed, 25 Apr 2018 00:02:37 +0400 Subject: [PATCH] Fix IP discovery in enable-ssh.sh --- scripts/enable-ssh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/enable-ssh.sh b/scripts/enable-ssh.sh index 4813aa3..c029cdc 100644 --- a/scripts/enable-ssh.sh +++ b/scripts/enable-ssh.sh @@ -27,7 +27,7 @@ sudo ufw allow OpenSSH > /dev/null 2>&1 EXT_IP=$(curl -sf https://www.appveyor.com/tools/my-ip.aspx) # get ip address of management network interface and figure out corresponding port on NAT -INT_IP=$(hostname --ip-address) +INT_IP=$(ip -o -4 addr show up primary scope global | ( read -r num dev fam addr rest; echo ${addr%/*}; )) IFS='.' read -r -a INT_IP_ARR <<< "$INT_IP" PORT=$(( 22000 + (${INT_IP_ARR[2]} - 0) * 256 + ${INT_IP_ARR[3]} ))