Skip to content

Instantly share code, notes, and snippets.

@lanky
Created May 9, 2022 14:09
Show Gist options
  • Save lanky/ebadea3315349f294230cb783a2a6e31 to your computer and use it in GitHub Desktop.
Save lanky/ebadea3315349f294230cb783a2a6e31 to your computer and use it in GitHub Desktop.
#!/bin/bash
gateway=$(netstat -rn|grep "/32" |grep -vi link |awk '{print $2}'|head -1)
DESTS="\
0.0.0.0/5\
8.0.0.0/7\
11.0.0.0/8\
12.0.0.0/6\
16.0.0.0/4\
32.0.0.0/3\
64.0.0.0/6\
68.0.0.0/8\
69.0.0.0/9\
69.128.0.0/11\
69.164.0.0/16\
69.192.0.0/10\
70.0.0.0/7\
72.0.0.0/5\
80.0.0.0/4\
96.0.0.0/6\
100.0.0.0/10\
100.128.0.0/9\
101.0.0.0/8\
102.0.0.0/7\
104.0.0.0/5\
112.0.0.0/6\
116.0.0.0/8\
117.64.0.0/10\
117.128.0.0/9\
118.0.0.0/7\
120.0.0.0/5\
128.0.0.0/3\
160.64.0.0/10\
160.128.0.0/9\
161.0.0.0/8\
162.0.0.0/7\
164.0.0.0/6\
168.0.0.0/6\
172.104.21.0/24\
172.128.0.0/9\
173.0.0.0/8\
174.0.0.0/7\
176.0.0.0/4\
192.0.0.0/7\
194.0.0.0/8\
195.0.0.0/9\
195.192.0.0/10\
196.0.0.0/7\
198.0.0.0/8\
199.0.0.0/10\
199.192.0.0/10\
200.0.0.0/7\
202.0.0.0/8\
203.128.0.0/9\
204.0.0.0/9\
204.192.0.0/10\
205.0.0.0/8\
205.185.0.0/16\
206.0.0.0/10\
206.192.0.0/10\
207.0.0.0/8\
208.64.0.0/10\
209.0.0.0/8\
210.0.0.0/7\
212.0.0.0/6\
216.0.0.0/5\
"
for NET in ${DESTS}; do
echo "route add -net ${NET} ${gateway} -expire 43200"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment