external IP detection fix

This commit is contained in:
bedefaced 2018-02-15 20:23:07 +03:00
parent c3667633ad
commit 6242f4b43c
3 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ LOCALMASK="/24"
LOCALIPMASK="$LOCALIP$LOCALMASK" 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 if [[ "$IP" = "" ]]; then
IP=$(wget -4qO- "http://whatismyip.akamai.com/") IP=$(wget -4qO- "http://whatismyip.akamai.com/")
fi fi

View File

@ -42,7 +42,7 @@ LOCALMASK="/24"
LOCALIPMASK="$LOCALIP$LOCALMASK" 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 if [[ "$IP" = "" ]]; then
IP=$(wget -4qO- "http://whatismyip.akamai.com/") IP=$(wget -4qO- "http://whatismyip.akamai.com/")
fi fi

View File

@ -37,7 +37,7 @@ LOCALMASK="/24"
LOCALIPMASK="$LOCALIP$LOCALMASK" 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 if [[ "$IP" = "" ]]; then
IP=$(wget -4qO- "http://whatismyip.akamai.com/") IP=$(wget -4qO- "http://whatismyip.akamai.com/")
fi fi