diff --git a/ipsec/env.sh b/ipsec/env.sh index cdb0289..968d580 100755 --- a/ipsec/env.sh +++ b/ipsec/env.sh @@ -44,7 +44,7 @@ LOCALMASK="/24" LOCALIPMASK="$LOCALIP$LOCALMASK" -IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) +IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '(127|10|100|172|192)\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) if [[ "$IP" = "" ]]; then IP=$(wget -4qO- "http://whatismyip.akamai.com/") fi diff --git a/openvpn/env.sh b/openvpn/env.sh index 26a726e..33120bd 100755 --- a/openvpn/env.sh +++ b/openvpn/env.sh @@ -42,7 +42,7 @@ LOCALMASK="/24" LOCALIPMASK="$LOCALIP$LOCALMASK" -IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) +IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '(127|10|100|172|192)\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) if [[ "$IP" = "" ]]; then IP=$(wget -4qO- "http://whatismyip.akamai.com/") fi diff --git a/pptp/env.sh b/pptp/env.sh index 45f5f7f..1f592db 100755 --- a/pptp/env.sh +++ b/pptp/env.sh @@ -37,7 +37,7 @@ LOCALMASK="/24" LOCALIPMASK="$LOCALIP$LOCALMASK" -IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) +IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '(127|10|100|172|192)\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) if [[ "$IP" = "" ]]; then IP=$(wget -4qO- "http://whatismyip.akamai.com/") fi