mirror of
https://github.com/angristan/openvpn-install.git
synced 2024-11-22 00:39:03 +01:00
Improve questions for NATed servers
This commit is contained in:
parent
4144fa9dff
commit
a0ff4d7cf9
@ -149,8 +149,7 @@ function installOpenVPN () {
|
||||
echo "You can leave the default options and just press enter if you are ok with them."
|
||||
echo ""
|
||||
echo "I need to know the IPv4 address of the network interface you want OpenVPN listening to."
|
||||
echo "If your server is running behind a NAT, (e.g. LowEndSpirit, Scaleway) leave the IP address as it is. (local/private IP)"
|
||||
echo "Otherwise, it should be your public IPv4 address."
|
||||
echo "Unless your server is behind NAT, it should be your public IPv4 address."
|
||||
|
||||
# Detect public IPv4 address and pre-fill for the user
|
||||
IP=$(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)
|
||||
@ -158,8 +157,11 @@ function installOpenVPN () {
|
||||
# If $IP is a private IP address, the server must be behind NAT
|
||||
if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
|
||||
echo ""
|
||||
echo "This server is behind NAT. What is the public IPv4 address or hostname?"
|
||||
read -rp "Public IP address / hostname: " -e PUBLICIP
|
||||
echo "It seems this server is behind NAT. What is its public IPv4 address?"
|
||||
echo "We need it for the clients to connect to the server."
|
||||
until [[ "$PUBLICIP" =~ ^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$ ]];do
|
||||
read -rp "Public IPv4 address: " -e PUBLICIP
|
||||
done
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
Loading…
Reference in New Issue
Block a user