diff --git a/wireguard-install.sh b/wireguard-install.sh index 325a4c6..12265fd 100755 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -50,7 +50,7 @@ if [ ! -f "$WG_CONFIG" ]; then GATEWAY_ADDRESS="${PRIVATE_SUBNET::-4}1" if [ "$SERVER_HOST" == "" ]; then - SERVER_HOST=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) + SERVER_HOST="$(dig +short myip.opendns.com @resolver1.opendns.com)" if [ "$INTERACTIVE" == "yes" ]; then read -p "Servers public IP address is $SERVER_HOST. Is that correct? [y/n]: " -e -i "y" CONFIRM if [ "$CONFIRM" == "n" ]; then