Last active
December 5, 2017 21:36
-
-
Save kalloc/61ba007bbf19b8668540 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget -q -O /tmp/ips http://reestr.rublacklist.net/api/ips || exit 404 | |
HASH=$(md5sum /tmp/ips | awk '{print $1}') | |
HASH_LAST=$(cat /tmp/ips.hash) | |
if [[ $HASH == $HASH_LAST ]] && [[ $(ip ro list dev tun2) != "" ]];then | |
exit 304 | |
fi | |
IPS=$(cat /tmp/ips | sed 's|;|\n|g' | /bin/grep -E ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$; cat /root/addition_ips) | |
for rule in $(ip ro list dev tun2 | awk '{print $1}');do | |
ip ro del $rule dev tun2 via 10.0.4.10 | |
done | |
for ip in $IPS;do | |
ip route add $ip dev tun2 via 10.0.4.10 | |
done | |
echo $HASH > /tmp/ips.hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
где 10.0.4.10 это IP туннеля до сервера за пределами сферы влияния РКН