-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpn
executable file
·53 lines (45 loc) · 1.55 KB
/
vpn
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
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
set -x
#sleep 5
#export inf=$(cat /proc/net/dev|grep -i vpn_office|awk -F: '{print $1}')
#add a ap connected detection
#write a function to verify ...
#or write a framework-style similar
#IP_SET=$(ip a s enp0s25|grep -i 'inet\b'|awk '{print $2}')
#SSID=$(iwconfig wlp4s0|grep -i essid|awk -FESSID: '{print $2}')
INF=$(cat /proc/net/dev|grep -i vpn_office|awk -F: '{print $1}')
ETH=$(sudo ethtool enp0s25|grep Link|awk '{print $3}')
if [ "$ETH" = "yes" ];then
sudo vpnclient stop
#sleep 1
echo 'a point'
touch /tmp/a
fi
INF=$(cat /proc/net/dev|grep -i vpn_office|awk -F: '{print $1}')
ETH=$(sudo ethtool enp0s25|grep Link|awk '{print $3}')
if [ "$INF" != "vpn_office" ] && [ "$ETH" = "no" ];then
sudo vpnclient start
sleep 1
#echo 'nameserver 10.28.1.212' > /etc/resolv.conf
echo 'b point'
touch /tmp/b
sudo ip a a 192.168.30.200/24 dev vpn_office
sudo ip r a 10.24.0.0/16 via 192.168.30.1
sudo ip r a 10.40.0.0/16 via 192.168.30.1
sudo ip r a 10.205.0.0/24 via 192.168.30.1
fi
SSID=$(iwconfig wlp4s0|grep -i essid|awk -FESSID: '{print $2}')
INF=$(cat /proc/net/dev|grep -i vpn_office|awk -F: '{print $1}')
ETH=$(sudo ethtool enp0s25|grep Link|awk '{print $3}')
if [ "$SSID" != "off/any" ] && [ "$ETH" = "no" ];then
#if [ "$SSID" = "AP2000" ] && [ "$ETH" = "no" ];then
sudo vpnclient start
sleep 1
#echo 'nameserver 10.28.1.212' > /etc/resolv.conf
echo 'c point'
touch /tmp/c
sudo ip a a 192.168.30.200/24 dev vpn_office
sudo ip r a 10.24.0.0/16 via 192.168.30.1
sudo ip r a 10.40.0.0/16 via 192.168.30.1
sudo ip r a 10.205.0.0/24 via 192.168.30.1
fi