Skip to content

Instantly share code, notes, and snippets.

@kyxap1
Last active February 22, 2021 19:13
Show Gist options
  • Save kyxap1/fe88e0c62774bad2e1eb52811dda8a4f to your computer and use it in GitHub Desktop.
Save kyxap1/fe88e0c62774bad2e1eb52811dda8a4f to your computer and use it in GitHub Desktop.
Asus RT-N56U custom vpn client script
#!/bin/sh
ACTION=${1}
DEBUG=1
func_res() {
[[ ${DEBUG:-0} -ge 1 ]] && set 2>&1 | logger -t vpnc-script
# how to get cidrs: http://kyxap.org.ua/articles/google_ip_range
CIDRS="$(cat /opt/home/admin/cidrs/*.txt)"
EXCLUDE="$(cat /opt/home/admin/cidrs/exclude/*.txt)"
set -- ${CIDRS}
gateway="$(echo $IPLOCAL | cut -d. -f1-3).1"
for net; do echo "ip route ${ACTION} $net via ${gateway} dev ${IFNAME} src ${IPLOCAL}"; done
for exclude in ${EXCLUDE}; do echo "ip route ${ACTION} ${exclude} dev eth3"; done
return 0
}
case "$ACTION" in
up)
ACTION=add
;;
down)
ACTION=del
;;
esac
func_res | tee /tmp/vpn.log | sh 2>&1 | logger -t vpnc-script
exit 0
2.16.0.0/13
23.0.0.0/12
23.32.0.0/11
23.64.0.0/14
23.72.0.0/16
23.74.0.0/15
23.76.0.0/14
23.192.0.0/11
42.99.255.0/24
46.33.73.0/24
58.27.86.0/23
59.144.52.0/24
59.144.56.0/24
59.144.115.0/24
59.151.0.0/16
60.254.0.0/16
62.154.232.0/24
62.156.209.0/24
62.159.74.0/24
63.84.59.0/24
63.85.36.0/24
63.141.0.0/16
63.144.176.0/24
63.150.131.0/24
63.162.234.0/24
63.168.61.0/24
63.208.195.0/24
63.243.206.0/24
64.86.201.0/24
64.145.0.0/16
64.171.167.0/24
65.121.210.0/24
65.122.93.0/24
65.163.176.0/24
65.173.24.0/24
65.197.197.0/24
65.197.244.0/24
66.171.0.0/16
66.198.8.0/24
67.131.232.0/24
69.22.0.0/16
69.31.0.0/16
69.192.0.0/16
70.39.163.0/24
70.39.178.0/24
72.246.0.0/15
80.12.192.0/24
80.67.0.0/16
80.146.174.0/24
80.231.241.0/24
81.52.133.0/24
81.52.201.0/24
82.96.58.0/24
84.53.0.0/16
88.221.0.0/16
92.122.0.0/15
93.158.110.0/24
95.100.0.0/15
96.6.0.0/15
96.16.0.0/15
103.238.148.0/24
104.64.0.0/16
104.66.0.0/16
111.92.162.0/24
115.124.93.0/24
118.214.0.0/15
122.252.128.0/24
125.56.0.0/16
172.224.0.0/13
172.232.0.0/15
173.222.0.0/15
173.245.192.0/24
173.245.196.0/23
173.245.198.0/24
173.245.212.0/24
173.245.214.0/24
184.24.0.0/13
184.50.0.0/15
184.84.0.0/14
190.90.221.0/24
190.90.222.0/23
190.210.32.0/24
193.108.88.0/24
193.108.91.0/24
193.108.92.0/24
193.108.94.0/24
193.108.152.0/24
193.108.155.0/24
193.247.166.0/23
194.224.66.0/24
195.49.93.0/24
195.57.81.0/24
195.57.152.0/24
195.59.122.0/24
195.95.193.0/24
195.175.69.0/24
195.245.124.0/23
195.245.126.0/24
196.41.99.0/24
198.47.108.0/24
198.144.96.0/24
198.144.98.0/23
198.144.100.0/24
198.144.112.0/24
198.144.115.0/24
198.144.119.0/24
201.220.10.0/24
202.74.62.0/23
202.125.100.0/24
203.101.53.0/24
203.146.247.0/24
204.8.48.0/22
204.10.28.0/22
204.93.32.0/24
204.93.34.0/24
204.93.36.0/22
204.93.40.0/24
204.93.42.0/24
204.93.44.0/24
204.93.46.0/24
204.93.48.0/24
204.93.62.0/24
204.95.24.0/23
205.161.113.0/24
205.185.204.0/24
205.234.218.0/24
205.234.225.0/24
205.246.30.0/24
208.34.250.0/24
209.95.152.0/24
209.107.202.0/23
209.107.205.0/24
209.107.206.0/23
209.107.209.0/24
209.107.213.0/24
209.107.215.0/24
209.107.220.0/22
209.136.40.0/24
209.170.90.0/24
209.170.94.0/24
209.170.97.0/24
209.170.113.0/24
209.170.115.0/24
209.170.116.0/23
209.170.118.0/24
209.234.250.0/24
209.234.252.0/24
210.16.40.0/24
213.254.17.0/24
216.151.176.0/24
216.151.187.0/24
216.206.30.0/24
216.246.75.0/24
216.246.87.0/24
216.246.93.0/24
216.246.122.0/24
217.89.107.0/24
3.0.0.0/15
3.5.0.0/20
3.5.16.0/21
3.5.128.0/22
3.5.132.0/23
3.5.208.0/22
3.5.212.0/23
3.6.0.0/15
3.8.0.0/13
3.16.0.0/13
3.24.0.0/14
3.32.0.0/16
3.34.0.0/15
3.80.0.0/12
3.96.0.0/15
3.101.0.0/16
3.104.0.0/14
3.112.0.0/14
3.120.0.0/13
3.128.0.0/12
3.208.0.0/12
3.224.0.0/12
3.248.0.0/13
13.32.0.0/15
13.35.0.0/16
13.48.0.0/15
13.52.0.0/14
13.56.0.0/14
13.112.0.0/14
13.124.0.0/14
13.208.0.0/14
13.212.0.0/15
13.224.0.0/12
13.244.0.0/15
13.248.0.0/18
13.248.96.0/21
13.248.104.0/22
13.248.108.0/23
13.248.111.0/24
13.248.112.0/21
13.248.120.0/22
13.248.124.0/24
13.248.126.0/23
13.248.128.0/17
13.249.0.0/16
13.250.0.0/15
15.161.0.0/16
15.164.0.0/15
15.177.0.0/18
15.177.64.0/20
15.177.80.0/21
15.177.88.0/22
15.185.0.0/16
15.188.0.0/16
15.193.0.0/19
15.197.0.0/23
15.197.2.0/24
15.197.4.0/22
15.200.0.0/16
15.206.0.0/15
15.221.0.0/23
15.221.4.0/23
15.221.8.0/21
15.221.16.0/20
15.222.0.0/15
15.228.0.0/15
15.230.6.0/24
15.230.18.0/24
15.230.21.0/24
15.230.22.0/23
15.230.24.0/21
15.230.32.0/24
15.230.35.0/24
15.230.38.0/23
15.230.40.0/24
15.236.0.0/15
15.254.0.0/16
18.130.0.0/16
18.132.0.0/14
18.136.0.0/16
18.138.0.0/15
18.140.0.0/14
18.144.0.0/15
18.153.0.0/16
18.156.0.0/14
18.162.0.0/15
18.166.0.0/15
18.175.0.0/16
18.176.0.0/13
18.184.0.0/15
18.188.0.0/14
18.192.0.0/11
18.224.0.0/13
18.232.0.0/14
18.236.0.0/15
18.246.0.0/16
18.252.0.0/15
23.20.0.0/14
27.0.0.0/22
34.192.0.0/10
35.72.0.0/13
35.152.0.0/13
35.160.0.0/12
35.176.0.0/13
36.103.232.0/25
36.103.232.128/26
43.250.192.0/23
44.192.0.0/10
46.51.128.0/18
46.51.192.0/20
46.51.216.0/21
46.51.224.0/19
46.137.0.0/16
50.16.0.0/14
50.112.0.0/16
52.0.0.0/11
52.32.0.0/13
52.40.0.0/14
52.44.0.0/15
52.46.0.0/17
52.46.128.0/19
52.46.164.0/22
52.46.168.0/21
52.46.176.0/21
52.46.184.0/22
52.46.192.0/19
52.46.224.0/20
52.46.240.0/22
52.46.249.0/24
52.46.250.0/23
52.46.252.0/22
52.47.0.0/16
52.48.0.0/12
52.64.0.0/12
52.80.0.0/15
52.82.0.0/17
52.82.128.0/19
52.82.160.0/21
52.82.168.0/24
52.82.169.0/27
52.82.176.0/21
52.82.184.0/23
52.82.187.0/24
52.82.188.0/22
52.82.192.0/18
52.83.0.0/16
52.84.0.0/14
52.88.0.0/14
52.92.0.0/19
52.92.32.0/22
52.92.40.0/21
52.92.48.0/22
52.92.60.0/22
52.92.72.0/21
52.92.88.0/22
52.92.252.0/22
52.93.0.0/22
52.93.4.0/23
52.93.8.0/22
52.93.12.12/31
52.93.14.18/31
52.93.16.0/23
52.93.18.178/31
52.93.19.236/31
52.93.20.0/24
52.93.21.14/31
52.93.34.56/31
52.93.35.212/31
52.93.37.222/31
52.93.38.0/24
52.93.43.0/24
52.93.48.0/24
52.93.51.28/31
52.93.56.0/23
52.93.59.0/24
52.93.60.0/24
52.93.62.0/23
52.93.64.0/24
52.93.67.0/24
52.93.69.0/24
52.93.73.0/26
52.93.75.0/24
52.93.76.0/24
52.93.78.0/24
52.93.80.0/23
52.93.96.0/22
52.93.112.0/24
52.93.120.178/32
52.93.122.131/32
52.93.126.76/32
52.93.126.132/30
52.93.126.136/30
52.93.126.144/30
52.93.126.204/31
52.93.129.95/32
52.93.131.217/32
52.93.133.127/32
52.93.133.129/32
52.93.133.131/32
52.93.133.133/32
52.93.133.153/32
52.93.133.155/32
52.93.133.175/32
52.93.133.177/32
52.93.133.179/32
52.93.133.181/32
52.93.134.181/32
52.93.135.195/32
52.93.137.0/24
52.93.138.252/31
52.93.139.252/31
52.93.146.5/32
52.93.149.0/24
52.93.150.0/23
52.93.153.80/32
52.93.156.0/22
52.93.236.0/23
52.93.245.0/24
52.93.247.0/25
52.93.248.0/22
52.93.254.0/24
52.94.0.0/20
52.94.16.0/22
52.94.20.0/24
52.94.22.0/23
52.94.24.0/22
52.94.28.0/23
52.94.30.0/24
52.94.32.0/19
52.94.64.0/22
52.94.68.0/23
52.94.72.0/21
52.94.80.0/20
52.94.96.0/19
52.94.192.0/22
52.94.196.0/23
52.94.198.0/25
52.94.198.128/27
52.94.199.0/24
52.94.200.0/24
52.94.201.0/26
52.94.204.0/22
52.94.208.0/20
52.94.224.0/20
52.94.240.0/21
52.94.248.0/25
52.94.248.128/26
52.94.248.192/27
52.94.248.224/28
52.94.249.32/27
52.94.249.64/26
52.94.249.128/26
52.94.252.0/22
52.95.0.0/20
52.95.16.0/21
52.95.24.0/22
52.95.28.0/24
52.95.29.0/26
52.95.30.0/23
52.95.34.0/23
52.95.36.0/22
52.95.40.0/23
52.95.42.0/24
52.95.48.0/20
52.95.64.0/18
52.95.128.0/21
52.95.136.0/23
52.95.138.0/24
52.95.142.0/23
52.95.144.0/20
52.95.160.0/20
52.95.176.0/24
52.95.192.0/20
52.95.208.0/21
52.95.216.0/22
52.95.224.0/22
52.95.228.0/23
52.95.230.0/24
52.95.239.0/24
52.95.240.0/21
52.95.248.0/22
52.95.252.0/23
52.95.254.0/24
52.95.255.0/25
52.95.255.128/27
52.119.128.0/18
52.119.192.0/21
52.119.205.0/24
52.119.206.0/23
52.119.208.0/20
52.119.224.0/20
52.119.240.0/21
52.119.248.0/23
52.119.252.0/22
52.124.128.0/17
52.144.192.0/24
52.144.193.0/25
52.144.193.128/26
52.144.194.0/24
52.144.195.0/26
52.144.196.192/26
52.144.197.128/25
52.144.199.128/26
52.144.200.64/26
52.144.200.128/26
52.144.201.64/26
52.144.201.128/26
52.144.208.64/26
52.144.208.128/25
52.144.209.0/24
52.144.210.0/24
52.144.211.0/25
52.144.211.128/26
52.144.211.192/29
52.144.211.200/30
52.144.212.64/26
52.144.212.192/26
52.144.213.64/26
52.144.214.128/26
52.144.215.0/30
52.144.215.192/29
52.144.215.200/30
52.144.216.0/29
52.144.216.8/30
52.144.218.0/25
52.144.224.64/26
52.144.224.128/25
52.144.225.0/25
52.144.225.128/26
52.144.227.64/26
52.144.227.192/26
52.144.228.64/26
52.144.228.128/25
52.144.229.0/25
52.144.230.0/26
52.144.231.64/26
52.192.0.0/12
52.208.0.0/13
52.216.0.0/15
52.218.0.0/16
52.219.0.0/19
52.219.32.0/20
52.219.48.0/22
52.219.56.0/21
52.219.64.0/21
52.219.72.0/22
52.219.80.0/20
52.219.96.0/19
52.219.128.0/21
52.219.136.0/22
52.219.140.0/24
52.220.0.0/15
52.222.0.0/16
54.64.0.0/11
54.144.0.0/12
54.160.0.0/11
54.192.0.0/12
54.208.0.0/13
54.216.0.0/14
54.220.0.0/15
54.222.0.0/19
54.222.32.0/21
54.222.48.0/21
54.222.57.0/24
54.222.58.0/28
54.222.58.32/27
54.222.59.0/24
54.222.64.0/22
54.222.128.0/17
54.223.0.0/16
54.224.0.0/14
54.228.0.0/15
54.230.0.0/16
54.231.0.0/17
54.231.128.0/18
54.231.192.0/20
54.231.232.0/21
54.231.244.0/22
54.231.248.0/22
54.231.252.0/24
54.232.0.0/14
54.236.0.0/15
54.238.0.0/16
54.239.0.0/24
54.239.1.0/26
54.239.1.64/28
54.239.1.81/32
54.239.1.82/31
54.239.1.96/27
54.239.1.128/28
54.239.2.0/23
54.239.4.0/22
54.239.8.0/21
54.239.16.0/20
54.239.32.0/21
54.239.40.152/29
54.239.48.0/20
54.239.64.0/21
54.239.96.0/24
54.239.98.0/23
54.239.100.0/23
54.239.104.0/21
54.239.112.0/23
54.239.115.0/25
54.239.116.0/22
54.239.120.0/21
54.239.128.0/18
54.239.192.0/19
54.240.17.0/24
54.240.128.0/18
54.240.192.0/21
54.240.200.0/24
54.240.202.0/23
54.240.204.0/22
54.240.208.0/20
54.240.225.0/24
54.240.226.0/23
54.240.228.0/22
54.240.232.0/22
54.240.236.1/32
54.240.236.2/32
54.240.236.5/32
54.240.236.6/32
54.240.236.9/32
54.240.236.10/32
54.240.236.13/32
54.240.236.14/32
54.240.236.17/32
54.240.236.18/32
54.240.236.21/32
54.240.236.22/32
54.240.236.25/32
54.240.236.26/32
54.240.236.29/32
54.240.236.30/32
54.240.236.33/32
54.240.236.34/32
54.240.236.37/32
54.240.236.38/32
54.240.236.41/32
54.240.236.42/32
54.240.236.45/32
54.240.236.46/32
54.240.236.49/32
54.240.236.50/32
54.240.236.53/32
54.240.236.54/32
54.240.236.57/32
54.240.236.58/32
54.240.236.61/32
54.240.236.62/32
54.240.236.65/32
54.240.236.66/32
54.240.236.69/32
54.240.236.70/32
54.240.236.73/32
54.240.236.74/32
54.240.236.77/32
54.240.236.78/32
54.240.236.81/32
54.240.236.82/32
54.240.236.85/32
54.240.236.86/32
54.240.236.89/32
54.240.236.90/32
54.240.236.93/32
54.240.236.94/32
54.240.241.0/24
54.240.244.0/22
54.240.248.0/21
54.241.0.0/16
54.242.0.0/15
54.244.0.0/14
54.248.0.0/13
58.254.138.0/25
58.254.138.128/26
63.32.0.0/14
64.252.64.0/18
64.252.128.0/18
65.0.0.0/14
65.8.0.0/16
65.9.0.0/17
65.9.128.0/18
67.202.0.0/18
68.79.0.0/18
70.132.0.0/18
70.224.192.0/18
71.152.0.0/17
72.21.192.0/19
72.44.32.0/19
75.2.0.0/17
75.101.128.0/17
76.223.0.0/17
79.125.0.0/17
87.238.80.0/21
96.127.0.0/17
99.77.128.0/20
99.77.144.0/23
99.77.147.0/24
99.77.148.0/22
99.77.152.0/21
99.77.160.0/23
99.77.186.0/23
99.77.188.0/22
99.77.247.0/24
99.77.250.0/24
99.77.253.0/24
99.77.254.0/24
99.78.128.0/19
99.78.160.0/21
99.78.168.0/22
99.78.172.0/24
99.78.176.0/20
99.78.192.0/21
99.78.208.0/20
99.79.0.0/16
99.80.0.0/15
99.82.128.0/18
99.83.64.0/21
99.83.128.0/17
99.84.0.0/16
99.86.0.0/16
100.20.0.0/14
100.24.0.0/13
103.4.8.0/21
103.8.172.0/22
103.246.148.0/22
107.20.0.0/14
108.128.0.0/13
108.166.224.0/19
108.175.48.0/21
108.175.56.0/22
111.51.66.0/24
116.129.226.0/25
116.129.226.128/26
118.193.97.64/26
118.193.97.128/25
119.147.182.0/25
119.147.182.128/26
120.52.12.64/26
120.52.22.96/27
120.52.39.128/27
120.52.153.192/26
120.232.236.0/25
120.232.236.128/26
120.253.240.192/26
120.253.241.160/27
120.253.245.128/26
120.253.245.192/27
122.248.192.0/18
130.137.180.0/23
130.176.0.0/16
140.179.0.0/16
143.204.0.0/16
144.220.0.0/16
150.222.2.0/24
150.222.5.0/24
150.222.6.0/23
150.222.10.0/24
150.222.11.0/31
150.222.12.0/23
150.222.66.0/23
150.222.69.0/24
150.222.70.0/23
150.222.72.0/21
150.222.80.0/22
150.222.84.0/23
150.222.87.0/24
150.222.88.0/21
150.222.96.0/22
150.222.100.0/23
150.222.102.0/24
150.222.104.0/23
150.222.106.0/24
150.222.108.0/23
150.222.110.0/24
150.222.112.0/24
150.222.114.0/23
150.222.116.0/22
150.222.121.0/24
150.222.129.112/28
150.222.129.128/29
150.222.129.136/30
150.222.129.140/31
150.222.133.0/24
150.222.134.0/23
150.222.136.0/24
150.222.138.0/24
150.222.140.0/22
150.222.176.0/22
150.222.180.0/24
150.222.196.0/24
150.222.199.0/25
150.222.202.0/24
150.222.204.0/22
150.222.208.64/27
150.222.208.96/31
150.222.210.0/24
150.222.213.40/31
150.222.214.0/23
150.222.218.0/23
150.222.220.0/22
150.222.224.0/24
150.222.227.0/24
150.222.228.0/23
150.222.233.0/24
150.222.234.0/23
150.222.236.0/23
150.222.239.0/24
150.222.240.131/32
150.222.240.135/32
150.222.240.137/32
150.222.240.161/32
150.222.240.207/32
150.222.240.237/32
150.222.240.239/32
150.222.240.245/32
150.222.240.247/32
150.222.240.249/32
150.222.240.251/32
150.222.242.84/31
150.222.242.97/32
150.222.242.99/32
150.222.242.214/31
150.222.242.227/32
150.222.242.229/32
150.222.242.231/32
150.222.242.233/32
150.222.243.9/32
150.222.243.11/32
150.222.243.13/32
150.222.243.15/32
150.222.243.17/32
150.222.243.19/32
150.222.243.33/32
150.222.243.35/32
150.222.243.37/32
150.222.243.39/32
150.222.243.41/32
150.222.243.43/32
150.222.243.45/32
150.222.243.47/32
150.222.243.51/32
150.222.243.53/32
150.222.243.55/32
150.222.243.57/32
150.222.243.59/32
150.222.243.177/32
150.222.244.35/32
150.222.244.37/32
150.222.245.122/31
157.175.0.0/16
160.1.0.0/16
161.189.0.0/16
162.213.232.0/22
162.250.236.0/22
172.96.97.0/24
172.96.98.0/24
174.129.0.0/16
175.41.128.0/17
176.32.64.0/19
176.32.96.0/20
176.32.112.0/21
176.32.120.0/22
176.32.124.128/25
176.32.125.0/24
176.34.0.0/16
177.71.128.0/17
177.72.240.0/21
178.236.0.0/20
180.163.57.0/25
180.163.57.128/26
184.72.0.0/15
184.169.128.0/17
185.48.120.0/22
185.143.16.0/24
199.127.232.0/22
203.83.220.0/22
204.236.128.0/17
204.246.160.0/19
205.251.192.0/19
205.251.224.0/20
205.251.240.0/21
205.251.248.0/22
205.251.252.0/23
205.251.254.0/24
207.171.160.0/19
208.86.88.0/22
210.51.40.0/24
216.137.32.0/19
216.182.224.0/20
223.71.11.0/27
223.71.71.96/27
223.71.71.128/25
104.18.216.232/32
104.18.217.232/32
172.65.207.106/32
3.6.106.81/32
3.7.2.84/32
3.34.26.58/32
3.105.147.174/32
3.106.158.203/32
13.114.40.48/32
13.125.114.27/32
13.209.163.61/32
13.229.188.59/32
13.230.158.120/32
13.233.76.15/32
13.234.168.60/32
13.234.176.102/32
13.234.210.38/32
13.236.14.80/32
13.236.229.21/32
13.237.44.5/32
13.238.54.232/32
13.250.94.254/32
13.250.168.23/32
13.250.177.223/32
15.164.81.167/32
18.138.202.180/32
18.140.96.234/32
18.141.90.153/32
18.179.245.253/32
18.181.13.223/32
18.228.52.138/32
18.228.67.229/32
18.228.167.86/32
18.229.199.252/32
18.231.5.6/32
18.231.104.233/32
52.63.152.235/32
52.63.231.178/32
52.64.108.95/32
52.69.186.44/32
52.69.239.207/32
52.74.223.119/32
52.78.231.108/32
52.192.72.89/32
54.168.17.15/32
54.169.195.247/32
54.180.75.25/32
54.207.47.76/32
54.233.131.104/32
54.238.117.237/32
140.82.112.0/20
185.199.108.0/22
192.30.252.0/22
35.184.0.0/13
35.190.247.0/24
35.191.0.0/16
35.192.0.0/12
35.208.0.0/12
35.224.0.0/12
64.233.160.0/19
66.102.0.0/20
66.249.80.0/20
72.14.192.0/18
74.125.0.0/16
108.177.8.0/21
108.177.96.0/19
130.211.0.0/22
172.217.0.0/19
172.217.32.0/20
172.217.128.0/19
172.217.160.0/20
172.217.192.0/19
172.253.56.0/21
172.253.112.0/20
173.194.0.0/16
209.85.128.0/17
216.58.192.0/19
216.239.32.0/19
212.224.112.0/20
216.228.112.0/20
91.132.60.0/24
195.82.146.0/24
34.64.0.0/10
52.84.0.0/14
52.88.0.0/13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment