Adding autodetection of the external IP using ifconfig.co

This commit is contained in:
nachootal 2019-03-20 20:33:04 +00:00
parent 43ccc5fd1c
commit ca29fd76e9

View File

@ -180,7 +180,14 @@ 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 PUBLICIP=$(curl -s ifconfig.co)
echo "If you just hit enter, autodetected $PUBLICIP will be used."
read -p "Public IP address / hostname: " -e INPUTPUBLICIP
if [ ! -z "$(INPUTPUBLICIP)"]
then
PUBLICIP=$INPUTPUBLICIP
fi
echo "Public IP set to: $PUBLICIP"
fi fi
echo echo
echo "Which protocol do you want for OpenVPN connections?" echo "Which protocol do you want for OpenVPN connections?"