Improve IP detection
This commit is contained in:
parent
8176f81e4f
commit
293e5d999a
12
vpnsetup.sh
12
vpnsetup.sh
@ -172,10 +172,10 @@ export DEBIAN_FRONTEND=noninteractive
|
||||
bigecho "Trying to auto discover IP of this server..."
|
||||
|
||||
# In case auto IP discovery fails, enter server's public IP here.
|
||||
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=$(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."
|
||||
public_ip=${VPN_PUBLIC_IP:-''}
|
||||
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" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
|
||||
|
||||
bigecho "Installing packages required for the VPN..."
|
||||
|
||||
@ -272,7 +272,7 @@ config setup
|
||||
|
||||
conn shared
|
||||
left=%defaultroute
|
||||
leftid=$PUBLIC_IP
|
||||
leftid=$public_ip
|
||||
right=%any
|
||||
encapsulation=yes
|
||||
authby=secret
|
||||
@ -537,7 +537,7 @@ IPsec VPN server is now ready for use!
|
||||
|
||||
Connect to your new VPN with these details:
|
||||
|
||||
Server IP: $PUBLIC_IP
|
||||
Server IP: $public_ip
|
||||
IPsec PSK: $VPN_IPSEC_PSK
|
||||
Username: $VPN_USER
|
||||
Password: $VPN_PASSWORD
|
||||
|
@ -124,10 +124,10 @@ bigecho "Installing packages required for setup..."
|
||||
bigecho "Trying to auto discover IP of this server..."
|
||||
|
||||
# In case auto IP discovery fails, enter server's public IP here.
|
||||
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=$(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."
|
||||
public_ip=${VPN_PUBLIC_IP:-''}
|
||||
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" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
|
||||
|
||||
bigecho "Adding the EPEL repository..."
|
||||
|
||||
@ -228,7 +228,7 @@ config setup
|
||||
|
||||
conn shared
|
||||
left=%defaultroute
|
||||
leftid=$PUBLIC_IP
|
||||
leftid=$public_ip
|
||||
right=%any
|
||||
encapsulation=yes
|
||||
authby=secret
|
||||
@ -461,7 +461,7 @@ IPsec VPN server is now ready for use!
|
||||
|
||||
Connect to your new VPN with these details:
|
||||
|
||||
Server IP: $PUBLIC_IP
|
||||
Server IP: $public_ip
|
||||
IPsec PSK: $VPN_IPSEC_PSK
|
||||
Username: $VPN_USER
|
||||
Password: $VPN_PASSWORD
|
||||
|
@ -140,10 +140,10 @@ bigecho "Installing packages required for setup..."
|
||||
bigecho "Trying to auto discover IP of this server..."
|
||||
|
||||
# In case auto IP discovery fails, enter server's public IP here.
|
||||
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=$(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."
|
||||
public_ip=${VPN_PUBLIC_IP:-''}
|
||||
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" || exiterr "Cannot detect this server's public IP. Edit the script and manually enter it."
|
||||
|
||||
bigecho "Adding the EPEL repository..."
|
||||
|
||||
@ -277,7 +277,7 @@ config setup
|
||||
|
||||
conn shared
|
||||
left=%defaultroute
|
||||
leftid=$PUBLIC_IP
|
||||
leftid=$public_ip
|
||||
right=%any
|
||||
encapsulation=yes
|
||||
authby=secret
|
||||
@ -549,7 +549,7 @@ IPsec VPN server is now ready for use!
|
||||
|
||||
Connect to your new VPN with these details:
|
||||
|
||||
Server IP: $PUBLIC_IP
|
||||
Server IP: $public_ip
|
||||
IPsec PSK: $VPN_IPSEC_PSK
|
||||
Username: $VPN_USER
|
||||
Password: $VPN_PASSWORD
|
||||
|
Loading…
Reference in New Issue
Block a user