Last active
August 29, 2015 14:26
-
-
Save samos123/8c92c3084dc72f2fc003 to your computer and use it in GitHub Desktop.
small bash script to connect and disconnect to tsinghua vpn and manually add routes.
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 | |
| if [ "$1" == "connect" ] | |
| then | |
| sudo pon my_tunnel | |
| until ip a | grep -q 192.168.55.1; | |
| do | |
| sleep 1 | |
| done | |
| sudo ip link set ppp0 mtu 1400 | |
| sudo ip route add 192.168.111.0/24 via 192.168.55.1 | |
| sudo ip route add 192.168.112.0/24 via 192.168.55.1 | |
| sudo ip route add 192.168.113.0/24 via 192.168.55.1 | |
| elif [ "$1" == "disconnect" ] | |
| then | |
| sudo poff my_tunnel | |
| else | |
| echo "Usage: $0 connect|disconnect" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment