IP env
This commit is contained in:
parent
e67382055b
commit
655f33b8f2
@ -14,3 +14,8 @@ LOCALIP="$LOCALPREFIX.0.0"
|
|||||||
LOCALMASK="/24"
|
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)
|
||||||
|
if [[ "$IP" = "" ]]; then
|
||||||
|
IP=$(wget -4qO- "http://whatismyip.akamai.com/")
|
||||||
|
fi
|
||||||
|
|||||||
@ -12,11 +12,6 @@ if [[ ! -e $IPTABLES ]] || [[ ! -r $IPTABLES ]] || [[ ! -w $IPTABLES ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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)
|
|
||||||
if [[ "$IP" = "" ]]; then
|
|
||||||
IP=$(wget -4qO- "http://whatismyip.akamai.com/")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# backup and remove rules with $LOCALIP
|
# backup and remove rules with $LOCALIP
|
||||||
iptables-save > $IPTABLES.backup
|
iptables-save > $IPTABLES.backup
|
||||||
|
|
||||||
|
|||||||
@ -12,3 +12,8 @@ LOCALIP="$LOCALPREFIX.0.0"
|
|||||||
LOCALMASK="/24"
|
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)
|
||||||
|
if [[ "$IP" = "" ]]; then
|
||||||
|
IP=$(wget -4qO- "http://whatismyip.akamai.com/")
|
||||||
|
fi
|
||||||
|
|||||||
@ -12,11 +12,6 @@ if [[ ! -e $IPTABLES ]] || [[ ! -r $IPTABLES ]] || [[ ! -w $IPTABLES ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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)
|
|
||||||
if [[ "$IP" = "" ]]; then
|
|
||||||
IP=$(wget -4qO- "http://whatismyip.akamai.com/")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# backup and remove rules with $LOCALIP
|
# backup and remove rules with $LOCALIP
|
||||||
iptables-save > $IPTABLES.backup
|
iptables-save > $IPTABLES.backup
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user