1
0
mirror of synced 2024-11-25 06:16:07 +03:00

Improve IP detection

This commit is contained in:
hwdsl2 2021-05-11 09:59:18 -05:00
parent 8176f81e4f
commit 293e5d999a
3 changed files with 18 additions and 18 deletions

View File

@ -172,10 +172,10 @@ export DEBIAN_FRONTEND=noninteractive
bigecho "Trying to auto discover IP of this server..." bigecho "Trying to auto discover IP of this server..."
# In case auto IP discovery fails, enter server's public IP here. # In case auto IP discovery fails, enter server's public IP here.
PUBLIC_IP=${VPN_PUBLIC_IP:-''} public_ip=${VPN_PUBLIC_IP:-''}
[ -z "$PUBLIC_IP" ] && PUBLIC_IP=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short) check_ip "$public_ip" || public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short)
check_ip "$PUBLIC_IP" || PUBLIC_IP=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com) check_ip "$public_ip" || public_ip=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com)
check_ip "$PUBLIC_IP" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it." check_ip "$public_ip" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
bigecho "Installing packages required for the VPN..." bigecho "Installing packages required for the VPN..."
@ -272,7 +272,7 @@ config setup
conn shared conn shared
left=%defaultroute left=%defaultroute
leftid=$PUBLIC_IP leftid=$public_ip
right=%any right=%any
encapsulation=yes encapsulation=yes
authby=secret authby=secret
@ -537,7 +537,7 @@ IPsec VPN server is now ready for use!
Connect to your new VPN with these details: Connect to your new VPN with these details:
Server IP: $PUBLIC_IP Server IP: $public_ip
IPsec PSK: $VPN_IPSEC_PSK IPsec PSK: $VPN_IPSEC_PSK
Username: $VPN_USER Username: $VPN_USER
Password: $VPN_PASSWORD Password: $VPN_PASSWORD

View File

@ -124,10 +124,10 @@ bigecho "Installing packages required for setup..."
bigecho "Trying to auto discover IP of this server..." bigecho "Trying to auto discover IP of this server..."
# In case auto IP discovery fails, enter server's public IP here. # In case auto IP discovery fails, enter server's public IP here.
PUBLIC_IP=${VPN_PUBLIC_IP:-''} public_ip=${VPN_PUBLIC_IP:-''}
[ -z "$PUBLIC_IP" ] && PUBLIC_IP=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short) check_ip "$public_ip" || public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short)
check_ip "$PUBLIC_IP" || PUBLIC_IP=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com) check_ip "$public_ip" || public_ip=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com)
check_ip "$PUBLIC_IP" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it." check_ip "$public_ip" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
bigecho "Adding the EPEL repository..." bigecho "Adding the EPEL repository..."
@ -228,7 +228,7 @@ config setup
conn shared conn shared
left=%defaultroute left=%defaultroute
leftid=$PUBLIC_IP leftid=$public_ip
right=%any right=%any
encapsulation=yes encapsulation=yes
authby=secret authby=secret
@ -461,7 +461,7 @@ IPsec VPN server is now ready for use!
Connect to your new VPN with these details: Connect to your new VPN with these details:
Server IP: $PUBLIC_IP Server IP: $public_ip
IPsec PSK: $VPN_IPSEC_PSK IPsec PSK: $VPN_IPSEC_PSK
Username: $VPN_USER Username: $VPN_USER
Password: $VPN_PASSWORD Password: $VPN_PASSWORD

View File

@ -140,10 +140,10 @@ bigecho "Installing packages required for setup..."
bigecho "Trying to auto discover IP of this server..." bigecho "Trying to auto discover IP of this server..."
# In case auto IP discovery fails, enter server's public IP here. # In case auto IP discovery fails, enter server's public IP here.
PUBLIC_IP=${VPN_PUBLIC_IP:-''} public_ip=${VPN_PUBLIC_IP:-''}
[ -z "$PUBLIC_IP" ] && PUBLIC_IP=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short) check_ip "$public_ip" || public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short)
check_ip "$PUBLIC_IP" || PUBLIC_IP=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com) check_ip "$public_ip" || public_ip=$(wget -t 3 -T 15 -qO- http://ipv4.icanhazip.com)
check_ip "$PUBLIC_IP" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it." check_ip "$public_ip" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
bigecho "Adding the EPEL repository..." bigecho "Adding the EPEL repository..."
@ -277,7 +277,7 @@ config setup
conn shared conn shared
left=%defaultroute left=%defaultroute
leftid=$PUBLIC_IP leftid=$public_ip
right=%any right=%any
encapsulation=yes encapsulation=yes
authby=secret authby=secret
@ -549,7 +549,7 @@ IPsec VPN server is now ready for use!
Connect to your new VPN with these details: Connect to your new VPN with these details:
Server IP: $PUBLIC_IP Server IP: $public_ip
IPsec PSK: $VPN_IPSEC_PSK IPsec PSK: $VPN_IPSEC_PSK
Username: $VPN_USER Username: $VPN_USER
Password: $VPN_PASSWORD Password: $VPN_PASSWORD