diff --git a/vpnsetup.sh b/vpnsetup.sh index 4cf7be0..de7ab87 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -117,6 +117,14 @@ case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in ;; esac +if [ -n "$VPN_DNS_SRV1" ] && ! check_ip "$VPN_DNS_SRV1"; then + exiterr "DNS server 'VPN_DNS_SRV1' is invalid." +fi + +if [ -n "$VPN_DNS_SRV2" ] && ! check_ip "$VPN_DNS_SRV2"; then + exiterr "DNS server 'VPN_DNS_SRV2' is invalid." +fi + bigecho "VPN setup in progress... Please be patient." # Create and change to working dir diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index a21bb0c..ebb4d40 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -106,6 +106,14 @@ case "$VPN_IPSEC_PSK $VPN_USER $VPN_PASSWORD" in ;; esac +if [ -n "$VPN_DNS_SRV1" ] && ! check_ip "$VPN_DNS_SRV1"; then + exiterr "DNS server 'VPN_DNS_SRV1' is invalid." +fi + +if [ -n "$VPN_DNS_SRV2" ] && ! check_ip "$VPN_DNS_SRV2"; then + exiterr "DNS server 'VPN_DNS_SRV2' is invalid." +fi + bigecho "VPN setup in progress... Please be patient." # Create and change to working dir