Update IKEv2 script

- Minor improvements
This commit is contained in:
hwdsl2 2020-12-13 15:52:03 -06:00
parent d9ab6ae1a5
commit 599c1dab15

View File

@ -238,8 +238,10 @@ if [ "$use_dns_name" = "1" ]; then
read -rp "Enter the DNS name of this VPN server: " server_addr read -rp "Enter the DNS name of this VPN server: " server_addr
done done
else else
echo "Trying to auto discover IP of this server..."
echo
public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short) public_ip=$(dig @resolver1.opendns.com -t A -4 myip.opendns.com +short)
[ -z "$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)
read -rp "Enter the IPv4 address of this VPN server: [$public_ip] " server_addr read -rp "Enter the IPv4 address of this VPN server: [$public_ip] " server_addr
[ -z "$server_addr" ] && server_addr="$public_ip" [ -z "$server_addr" ] && server_addr="$public_ip"
until check_ip "$server_addr"; do until check_ip "$server_addr"; do
@ -275,7 +277,6 @@ while printf '%s' "$client_validity" | LC_ALL=C grep -q '[^0-9]\+' \
done done
# Enter custom DNS servers # Enter custom DNS servers
use_custom_dns=0
echo echo
echo "By default, clients are set to use Google Public DNS when the VPN is active." echo "By default, clients are set to use Google Public DNS when the VPN is active."
printf "Do you want to specify custom DNS servers for IKEv2? [y/N] " printf "Do you want to specify custom DNS servers for IKEv2? [y/N] "
@ -310,6 +311,8 @@ if [ "$use_custom_dns" = "1" ]; then
else else
dns_servers="$dns_server_1" dns_servers="$dns_server_1"
fi fi
else
echo "Using Google Public DNS (8.8.8.8, 8.8.4.4)."
fi fi
# Check for MOBIKE support # Check for MOBIKE support
@ -340,6 +343,18 @@ if [ "$mobike_support" = "1" ]; then
fi fi
fi fi
echo
echo -n "Checking for MOBIKE support... "
if [ "$mobike_support" = "1" ]; then
if [ "$in_container" = "0" ]; then
echo "Available"
else
echo "Running in container, see notes below"
fi
else
echo "Not available"
fi
mobike_enable=0 mobike_enable=0
if [ "$mobike_support" = "1" ]; then if [ "$mobike_support" = "1" ]; then
echo echo
@ -392,17 +407,16 @@ fi
if [ "$mobike_support" = "1" ]; then if [ "$mobike_support" = "1" ]; then
if [ "$mobike_enable" = "1" ]; then if [ "$mobike_enable" = "1" ]; then
echo "Enable MOBIKE support: Yes" echo "MOBIKE support: Enable"
else else
echo "Enable MOBIKE support: No" echo "MOBIKE support: Disable"
fi fi
else
echo "MOBIKE support: Not available"
fi fi
if [ "$use_custom_dns" = "1" ]; then cat <<EOF
echo "DNS server(s): $dns_servers" DNS server(s): $dns_servers
fi
cat <<'EOF'
================================================ ================================================