-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathvpnchain_helper.sh
More file actions
40 lines (36 loc) · 827 Bytes
/
vpnchain_helper.sh
File metadata and controls
40 lines (36 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
UP=
DOWN=
LAST=
while getopts “udl” OPTION
do
case $OPTION in
u)
UP=1;
;;
d)
DOWN=1;
;;
l)
LAST=1;
;;
esac
done
if [ -n "$UP" ]; then
if [ -n "$LAST" ]; then
/sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw $6;
/sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw $6;
#echo "[DEBUG] /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw $6;"
/etc/openvpn/update-resolv-conf
else
/sbin/route add -net $2 netmask 255.255.255.255 gw $6;
#echo "[DEBUG] /sbin/route add -net $2 netmask 255.255.255.255 gw $6"
fi
fi
if [ -n "$DOWN" ]; then
if [ -n "$LAST" ]; then
/etc/openvpn/update-resolv-conf
else
/etc/openvpn/update-resolv-conf
fi
fi