l-n-s / wireguard-install

WireGuard VPN server installer
MIT License
656 stars 166 forks source link

was getting the wrong host ip #8

Open OhioVR opened 5 years ago

OhioVR commented 5 years ago

On my Ubuntu 16 server install the line:

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)

was producing my server's lan IP and I was unable to connect to websites on iOS

Changing that line to:

SERVER_HOST="$(dig +short myip.opendns.com @resolver1.opendns.com)"

found my WAN IP and I was able to connect

I didn't do a pull request because I don't know if that would break other distros

ghost commented 5 years ago

https://coderwall.com/p/lyrjsq/extract-your-external-ip-using-command-line-tools