Auto detect IP behind NAT.

Use openDNS to detect public IP behind NAT.
This commit is contained in:
Matthew Frost 2019-08-08 12:23:18 +02:00 committed by GitHub
parent 43ef4f920d
commit 7d88709f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,7 @@ else
if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
echo echo
echo "This server is behind NAT. What is the public IPv4 address or hostname?" echo "This server is behind NAT. What is the public IPv4 address or hostname?"
read -p "Public IP address / hostname: " -e PUBLICIP IP=`dig +short myip.opendns.com @resolver1.opendns.com`
fi fi
echo echo
echo "Which protocol do you want for OpenVPN connections?" echo "Which protocol do you want for OpenVPN connections?"